java.lang.Object | |
↳ | com.pdftron.pdf.Page |
Page is a high-level class representing PDF page object (see 'Page Objects' in Section 3.6.2, 'Page Tree,' in PDF Reference Manual). Among other associated objects, a page object contains:
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | e_0 | Specifies page rotation, in degrees. | |||||||||
int | e_180 | The Constant e_180. | |||||||||
int | e_270 | The Constant e_270. | |||||||||
int | e_90 | The Constant e_90. | |||||||||
int | e_action_trigger_page_close | Triggered when the page is closed, This action applies to the page being closed and shall be executed before any other page is opened | |||||||||
int | e_action_trigger_page_open | Triggered when the page is opened and shall be executed after such an action | |||||||||
int | e_art | The Constant e_art. | |||||||||
int | e_bleed | The Constant e_bleed. | |||||||||
int | e_crop | The Constant e_crop. | |||||||||
int | e_media | PDF page can define as many as five separate boundaries to control various aspects of the imaging process (for more details please refer to Section 10.10.1 'Page Boundaries' in PDF Reference Manual): - The media box defines the boundaries of the physical medium on which the page is to be printed. | |||||||||
int | e_trim | The Constant e_trim. | |||||||||
int | e_user_crop | The Constant e_user_crop. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Page()
Initialize a page using an existing low-level Cos/SDF page object.
| |||||||||||
Page(Obj page_dict)
Instantiates a new page from page dictionary
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static Page | __Create(long impl, Object ref) | ||||||||||
long | __GetHandle() | ||||||||||
static int |
addRotations(int r0, int r1)
Rotate r0 clockwise by r1
| ||||||||||
void |
annotInsert(int pos, Annot annot)
Adds an annotation at the specified location in a page's annotation array.
| ||||||||||
void |
annotPushBack(Annot annot)
Adds an annotation to the end of a page's annotation array.
| ||||||||||
void |
annotPushFront(Annot annot)
Adds an annotation to the beginning of a page's annotation array.
| ||||||||||
void |
annotRemove(int index)
Removes the annoation at a given location.
| ||||||||||
void |
annotRemove(Annot annot)
Removes the given annotation from the page.
| ||||||||||
static int |
degreeToRotation(int r)
Convert a number that represents rotation in degrees to a rotation enum.
| ||||||||||
Obj |
findInheritedAttribute(String attrib)
Some of the page attributes are designated as inheritable.
| ||||||||||
void |
flattenField(Field field)
Flatten/Merge existing form field appearances with the page content and
remove widget annotation.
| ||||||||||
Annot |
getAnnot(int index)
Get the annotation on the page.
| ||||||||||
Obj |
getAnnots()
Returns a SDF/Cos array containing annotation dictionaries.
| ||||||||||
Rect |
getBox(int type)
Get the box specified page bounding box
| ||||||||||
Obj |
getContents()
Get the contents of current page.
| ||||||||||
Rect |
getCropBox()
Get the crop box.
| ||||||||||
Matrix2D |
getDefaultMatrix(boolean flip_y, int box_type, int rot_type)
Get the default matrix.
| ||||||||||
Matrix2D |
getDefaultMatrix()
Get the default matrix.
| ||||||||||
int |
getIndex()
Get the page index/number.
| ||||||||||
Rect |
getMediaBox()
Get the media box.
| ||||||||||
int |
getNumAnnots()
Get the number of annotations on a page.
| ||||||||||
double |
getPageHeight()
Get the crop box page height.
| ||||||||||
double |
getPageHeight(int box_type)
Get the page height for the given page bounding box
| ||||||||||
double |
getPageWidth(int box_type)
Get the page width for the given bounding box
| ||||||||||
double |
getPageWidth()
Get the crop box page width.
| ||||||||||
Obj |
getResourceDict()
Get the resource dictionary of current page.
| ||||||||||
int |
getRotation()
Get the rotation.
| ||||||||||
Obj |
getSDFObj()
Get the page dictionary.
| ||||||||||
Obj |
getThumb()
Gets the object representing the Image thumbnail.
| ||||||||||
int[] |
getThumbInfo()
Gets the associated thumbnail information.
| ||||||||||
Obj |
getTriggerAction(int trigger)
Get the Action associated with the selected Page Trigger event.
| ||||||||||
double |
getUserUnitSize()
Get the UserUnit value for the page.
| ||||||||||
Rect |
getVisibleContentBox()
The bounding box is defined as the smallest rectangle that includes all the visible content on the page.
| ||||||||||
boolean |
hasTransition()
Tests whether this page has a transition.
| ||||||||||
boolean |
isValid()
Checks if current page is valid.
| ||||||||||
static int |
rotationToDegree(int r)
Convert a rotation to a number.
| ||||||||||
void |
scale(double scale)
A utility method used to scale physical dimensions of the page including
all page content.
| ||||||||||
void |
setBox(int type, Rect box)
Set the page bounding box specified by 'page_region' for this page.
| ||||||||||
void |
setCropBox(Rect box)
Set the crop box for this page.
| ||||||||||
void |
setMediaBox(Rect box)
Set the media box for this page.
| ||||||||||
void |
setRotation(int rot_type)
Set the rotation value for this page.
| ||||||||||
void |
setUserUnitSize(double unit_size)
Set the UserUnit value for a page.
| ||||||||||
static int |
subtractRotations(int r0, int r1)
Rotate r0 counter clockwise by r1.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Specifies page rotation, in degrees.
The Constant e_180.
The Constant e_270.
The Constant e_90.
Triggered when the page is closed, This action applies to the page being closed and shall be executed before any other page is opened
Triggered when the page is opened and shall be executed after such an action
The Constant e_art.
The Constant e_bleed.
The Constant e_crop.
PDF page can define as many as five separate boundaries to control various aspects of the imaging process (for more details please refer to Section 10.10.1 'Page Boundaries' in PDF Reference Manual): - 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 can safely be discarded without affecting the meaning of the PDF file. - The crop box defines the region to which the contents of the page are to 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. The default value is the page's media box. - The bleed box defines the region to which the contents of the page should 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 default value is the page's crop box. - The trim box 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 color bars. The default value is the page's crop box. - The art box 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. - The user crop box defines a custom region to which the contents of the page are to be clipped (cropped) when displayed by PDFNet It must be fully contained within the e_crop box. The default value is the page's crop box.
The Constant e_trim.
The Constant e_user_crop.
Initialize a page using an existing low-level Cos/SDF page object.
Note: This constructor does not copy any data, but is instead the logical equivalent of a type cast.
Note: Because PDF::PDFDoc provides a complete high-level interface for Page creation and traversal this constructor is rarely used.
Instantiates a new page from page dictionary
page_dict | page dictionary as Obj |
---|
Rotate r0 clockwise by r1
r0 | first rotation. |
---|---|
r1 | second rotation. |
PDFNetException |
---|
Adds an annotation at the specified location in a page's annotation array.
pos | - The location in the array to insert the object. The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= GetNumAnnots(), the method appends the annotation to the array. |
---|---|
annot | - The annotation to add. |
PDFNetException |
---|
Adds an annotation to the end of a page's annotation array.
annot | - The annotation to prepend in a page's annotation array. |
---|
PDFNetException |
---|
Adds an annotation to the beginning of a page's annotation array.
annot | - The annotation to append in a page's annotation array. |
---|
PDFNetException |
---|
Removes the annoation at a given location.
Note: Removing the annotation invalidates any associated Annot object.
index | - A zero based index of the annotation to remove. |
---|
PDFNetException |
---|
Removes the given annotation from the page.
Note: Removing the annotation invalidates the given Annot object.
annot | the annotation to remove |
---|
PDFNetException |
---|
Convert a number that represents rotation in degrees to a rotation enum.
r | degree to convert to rotation. Valid numbers are multiples of 90. |
---|
PDFNetException |
---|
Some of the page attributes are designated as inheritable. If such an attribute is omitted from a page object, its value is inherited from an ancestor node in the page tree. If the attribute is a required one, a value must be supplied in an ancestor node; if it is optional and no inherited value is specified, the default value should be used. The function walks up the page inhritance tree in search for specified attribute.
attrib | the inherited attribute to find |
---|
PDFNetException |
---|
Flatten/Merge existing form field appearances with the page content and remove widget annotation. Form 'flattening' refers to the operation that changes active form fields into a static area that is part of the PDF document, just like the other text and images in the document. A completely flattened PDF form does not have any widget annotations or interactive fields.
Note: An alternative approach to set the field as read only is using Field.SetFlag(Field::e_read_only, true) method. Unlike Field.SetFlag(...), the result of FlattenField() operation can not be programatically reversed.
field | the field to flatten |
---|
PDFNetException |
---|
Get the annotation on the page.
index | The index of the annotation to get on apage. The first annotation on a page has an index of zero. |
---|
PDFNetException |
---|
Returns a SDF/Cos array containing annotation dictionaries.
PDFNetException |
---|
Get the box specified page bounding box
type | The type of the page bounding box. Possible values are: e_media, e_crop, e_bleed, e_trim, and e_art. If the value for 'type' is e_crop, this call is equivalent to GetCropBox(). If the value for 'type' is e_media, this call is equivalent to GetMediaBox(). |
---|
PDFNetException |
---|
Get the contents of current page.
PDFNetException |
---|
Get the crop box.
Note: this method is equivalent to GetBox(Page.e_crop)
PDFNetException |
---|
Get the default matrix.
flip_y | this parameter can be used to mirror the page. if 'flip_y' is true the Y axis is not flipped and it is increasing, otherwise Y axis is decreasing. |
---|---|
box_type | an optional parameter used to specify the page box/region that the matrix should map to. By default, the function transforms user space coordinates to cropped coordinates. |
rot_type | the rot_type |
PDFNetException |
---|
Get the default matrix.
PDFNetException |
---|
Get the page index/number.
PDFNetException |
---|
Get the media box.
Note: this method is equivalent to GetBox(Page::e_media)
PDFNetException |
---|
Get the number of annotations on a page. Widget annotations (form fields) are included in the count.
PDFNetException |
---|
Get the crop box page height.
PDFNetException |
---|
Get the page height for the given page bounding box
box_type | the input bounding box type |
---|
PDFNetException |
---|
Get the page width for the given bounding box
box_type | given page bounding type |
---|
PDFNetException |
---|
Get the crop box page width.
PDFNetException |
---|
Get the resource dictionary of current page.
PDFNetException |
---|
Get the page dictionary.
Gets the object representing the Image thumbnail.
Note: If the page does not contain embedded thumbnail information, this method will return null.
PDFNetException |
---|
Gets the associated thumbnail information.
Note: If the page does not contain embedded thumbnail information, this method will return null.
PDFNetException |
---|
Get the Action associated with the selected Page Trigger event.
trigger | the type of trigger event to get |
---|
PDFNetException |
---|
Get the UserUnit value for the page. A UserUnit is a positive number giving the size of default user space units, in multiples of 1/72 inch.
PDFNetException |
---|
The bounding box is defined as the smallest rectangle that includes all the visible content on the page.
PDFNetException |
---|
Tests whether this page has a transition.
PDFNetException |
---|
Checks if current page is valid.
PDFNetException |
---|
Convert a rotation to a number.
r | rotation to convert to number |
---|
PDFNetException |
---|
A utility method used to scale physical dimensions of the page including all page content.
Note: Unlike SetUserUnitSize(unit_size) which is only supported in PDF 1.6 (i.e. Acrobat 7) and above, page.Scale(sc) supports all PDF versions.
scale | A number greater than 0 which is used as a scale factor. For example, calling page.Scale(0.5) will reduce physical dimensions of the page to half its original size, whereas page.Scale(2) will double the physical dimensions of the page and will rescale all page content appropriately. |
---|
PDFNetException |
---|
Set the page bounding box specified by 'page_region' for this page.
type | The type of the page bounding box. Possible values are: e_media, e_crop, e_bleed, e_trim, and e_art. |
---|---|
box | A rectangle specifying the coordinates to set for the box. The coordinates are specified in user space units. |
PDFNetException |
---|
Set the crop box for this page. The crop box is the region of the page to display and print.
Note: this method is equivalent to SetBox(Page.e_crop)
box | the new crop box for this page. The page dimensions are specified in user space coordinates. The crop box defines the region to which the contents of the page are to be clipped (cropped) when displayed or printed. |
---|
PDFNetException |
---|
Set the media box for this page.
Note: this method is equivalent to SetBox(Page::e_media)
box | the new media box for this page. The page dimensions are specified in user space coordinates. 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. |
---|
PDFNetException |
---|
Set the UserUnit value for a page.
Note: This is a PDF 1.6 feature. See the implementation note 171 in PDF Reference for details.
unit_size | A positive number giving the size of default user space units, in multiples of 1/72 inch. |
---|
PDFNetException |
---|
Rotate r0 counter clockwise by r1.
r0 | first rotation. |
---|---|
r1 | second rotation. |
PDFNetException |
---|