public class Page extends NativeObject
Modifier and Type | Method and Description |
---|---|
static Page |
copy(Document targetDocument,
Page page,
PageCopyOptions options)
Copy a page
|
static Page |
create(Document targetDocument,
Size size)
Create an empty page
|
static Page |
createDynamicObject(long handle) |
AnnotationList |
getAnnotations()
the list of this page's annotations.
|
Rectangle |
getArtBox()
The art box of the page.
|
Rectangle |
getBleedBox()
The bleed box of the page.
|
Content |
getContent()
the page content.
|
LinkList |
getLinks()
the list of this page's links.
|
Rectangle |
getMediaBox()
The media box of the page.
|
Metadata |
getMetadata()
the metadata of the page.
|
Size |
getSize()
the visible size of the page (crop box).
|
Rectangle |
getTrimBox()
The trim box of the page.
|
WidgetList |
getWidgets()
the list of this page's form field widgets.
|
void |
rotate(Rotation rotate)
Rotate the page by a multiple of 90 degrees.
|
void |
setMetadata(Metadata value)
the metadata of the page.
|
void |
updateSize(Rectangle rectangle)
Update the page size to a specified rectangle.
|
equals, hashCode
public static Page createDynamicObject(long handle)
public static Page create(Document targetDocument, Size size)
targetDocument
- the output document with which the returned object is associatedsize
- the page sizejava.lang.IllegalArgumentException
- if the targetDocument
argument is null
java.lang.IllegalArgumentException
- if the targetDocument
argument has already been closedjava.lang.IllegalArgumentException
- if the targetDocument
argument is read-onlyjava.lang.IllegalArgumentException
- if size
is null
public static Page copy(Document targetDocument, Page page, PageCopyOptions options) throws java.io.IOException, CorruptException, ConformanceException
targetDocument
.
The returned object is associated with the given target document but not yet part of it.
It can be appended to the document's page list.targetDocument
- the output document with which the returned object is associatedpage
- a page of a different documentoptions
- the copy optionsjava.io.IOException
- Error reading from the source document or writing to the target documentCorruptException
- The source document is corruptConformanceException
- The conformance level of the source document is not compatible
with the conformance level of the target document.ConformanceException
- The explicitly requested conformance level is PDF/A Level A
(Conformance.PDF_A1_A
, Conformance.PDF_A2_A
,
or Conformance.PDF_A3_A
)
and the copy option PageCopyOptions.getCopyLogicalStructure()
is not set.java.lang.IllegalArgumentException
- if the targetDocument
argument is null
java.lang.IllegalArgumentException
- if the targetDocument
argument has already been closedjava.lang.IllegalArgumentException
- if the targetDocument
argument is read-onlyjava.lang.IllegalArgumentException
- if the page
object is not associated with an input documentjava.lang.IllegalArgumentException
- if the argument options
has PageCopyOptions.getFormFields()
set to forms.FormFieldCopyStrategy.COPY
and the targetDocument
contains form fields that have either been copied explicitly
with forms.FieldNode.copy
or created with forms.CheckBox.create
,
forms.ComboBox.create
, forms.CombTextField.create
,
forms.GeneralTextField.create
, forms.ListBox.create
,
forms.RadioButtonGroup.create
, or forms.SubForm.create
.java.lang.IllegalArgumentException
- if the argument options
has PageCopyOptions.getUnsignedSignatures()
set to CopyStrategy.COPY
and the targetDocument
contains form fields that have either been copied explicitly
with forms.FieldNode.copy
or created with forms.CheckBox.create
,
forms.ComboBox.create
, forms.CombTextField.create
,
forms.GeneralTextField.create
, forms.ListBox.create
,
forms.RadioButtonGroup.create
, or forms.SubForm.create
.java.lang.IllegalArgumentException
- if options
has PageCopyOptions.getCopyOutlineItems()
set to true
and the targetDocument
contains outline items that have been copied explicitly
with navigation.OutlineItem.copy
.java.lang.IllegalArgumentException
- if the page
argument is null
java.lang.IllegalArgumentException
- if the page
object has already been closedpublic void updateSize(Rectangle rectangle)
rectangle
- the rectangle to update the page size to.java.lang.IllegalStateException
- if the owning document has already been closedjava.lang.IllegalStateException
- if the page has already been closedjava.lang.UnsupportedOperationException
- if the page is read-onlyjava.lang.IllegalArgumentException
- if rectangle
is null
public void rotate(Rotation rotate)
rotate
- the desired rotationjava.lang.IllegalStateException
- if the owning document has already been closedjava.lang.IllegalStateException
- if the page has already been closedjava.lang.UnsupportedOperationException
- if the page is read-onlyjava.lang.IllegalArgumentException
- if rotate
is null
public Size getSize()
The page size corresponds to the size of the crop box. Since all coordinates are normalized to the origin of the crop box, the normalized origin of the crop box is always (0,0) and thus only the size is required.
The crop box defines the region to which the contents of the page shall be clipped (cropped) when displayed or printed. Unlike the other boxes, the crop box has no defined meaning in terms of physical page geometry or intended use; it merely imposes clipping on the page contents. However, in the absence of additional information (such as imposition instructions specified in a JDF job ticket), the crop box determines how the page's contents shall be positioned on the output medium. The default value is the page's media box.
This property cannot be null
.
java.lang.IllegalStateException
- if the page has already been closedpublic Rectangle getMediaBox()
The media box defines the boundaries of the physical medium on which the page is to be printed. It may include any extended area surrounding the finished page for bleed, printing marks, or other such purposes. It may also include areas close to the edges of the medium that cannot be marked because of physical limitations of the output device. Content falling outside this boundary may safely be discarded without affecting the meaning of the PDF file.
This property cannot be null
.
java.lang.IllegalStateException
- if the page has already been closedpublic Rectangle getBleedBox()
The bleed box (PDF 1.3) defines the region to which the contents of the page shall be clipped when output in a production environment. This may include any extra bleed area needed to accommodate the physical limitations of cutting, folding, and trimming equipment. The actual printed page may include printing marks that fall outside the bleed box. The default value is the page's crop box.
This property is null
if the page contains no explicit bleed box.
java.lang.IllegalStateException
- if the page has already been closedpublic Rectangle getTrimBox()
The trim box (PDF 1.3) defines the intended dimensions of the finished page after trimming. It may be smaller than the media box to allow for production-related content, such as printing instructions, cut marks, or colour bars. The default value is the page's crop box.
This property is null
if the page contains no explicit trim box.
java.lang.IllegalStateException
- if the page has already been closedpublic Rectangle getArtBox()
The art box (PDF 1.3) defines the extent of the page's meaningful content (including potential white-space) as intended by the page’s creator. The default value is the page's crop box.
This property is null
if the page contains no explicit art box.
java.lang.IllegalStateException
- if the page has already been closedpublic Content getContent()
java.lang.IllegalStateException
- if the page has already been closedpublic AnnotationList getAnnotations()
null
java.lang.IllegalStateException
- if the page has already been closedpublic LinkList getLinks()
null
java.lang.IllegalStateException
- if the page has already been closedpublic WidgetList getWidgets()
null
java.lang.IllegalStateException
- if the page has already been closedpublic Metadata getMetadata()
If the document is writable, the metadata object will be writable too and all changes to the metadata object are reflected in the document.
This property is null
if the page has not metadata.
java.lang.IllegalStateException
- if the document has already been closedpublic void setMetadata(Metadata value)
If the document is writable, the metadata object will be writable too and all changes to the metadata object are reflected in the document.
This property is null
if the page has not metadata.
java.lang.IllegalStateException
- if the document has already been closedjava.lang.UnsupportedOperationException
- if the document is read-onlyjava.lang.IllegalArgumentException
- if the given Metadata
object belongs to a different documentjava.lang.IllegalArgumentException
- if the given Metadata
object has already been closed