public class Page
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
e_0
Specifies page rotation, in degrees.
|
static int |
e_180
The Constant e_180.
|
static int |
e_270
The Constant e_270.
|
static int |
e_90
The Constant e_90.
|
static 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
|
static int |
e_action_trigger_page_open
Triggered when the page is opened and shall be executed after such an action
|
static int |
e_art
The Constant e_art.
|
static int |
e_bleed
The Constant e_bleed.
|
static int |
e_crop
The Constant e_crop.
|
static 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.
|
static int |
e_trim
The Constant e_trim.
|
static int |
e_user_crop
The Constant e_user_crop.
|
Constructor and Description |
---|
Page()
Initialize a page using an existing low-level Cos/SDF page object.
|
Page(Obj page_dict)
Instantiates a new page from page dictionary
|
Modifier and Type | Method and Description |
---|---|
static Page |
__Create(long impl,
java.lang.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(Annot annot)
Removes the given annotation from the page.
|
void |
annotRemove(int index)
Removes the annoation at a given location.
|
static int |
degreeToRotation(int r)
Convert a number that represents rotation in degrees to a rotation enum.
|
Obj |
findInheritedAttribute(java.lang.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()
Get the default matrix.
|
Matrix2D |
getDefaultMatrix(boolean flip_y,
int box_type,
int rot_type)
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()
Get the crop box page width.
|
double |
getPageWidth(int box_type)
Get the page width for the given bounding box
|
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.
|
public static final int e_action_trigger_page_open
public static final int e_action_trigger_page_close
public static final int e_media
public static final int e_crop
public static final int e_bleed
public static final int e_trim
public static final int e_art
public static final int e_user_crop
public static final int e_0
public static final int e_90
public static final int e_180
public static final int e_270
public Page()
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.
public Page(Obj page_dict)
page_dict
- page dictionary as Objpublic boolean isValid() throws PDFNetException
PDFNetException
public int getIndex() throws PDFNetException
PDFNetException
public Obj getTriggerAction(int trigger) throws PDFNetException
trigger
- the type of trigger event to getPDFNetException
public Rect getBox(int type) throws PDFNetException
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
public void setBox(int type, Rect box) throws PDFNetException
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
public Rect getCropBox() throws PDFNetException
Note: this method is equivalent to GetBox(Page.e_crop)
PDFNetException
public void setCropBox(Rect box) throws PDFNetException
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
public Rect getMediaBox() throws PDFNetException
Note: this method is equivalent to GetBox(Page::e_media)
PDFNetException
public void setMediaBox(Rect box) throws PDFNetException
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
public Rect getVisibleContentBox() throws PDFNetException
PDFNetException
public static int addRotations(int r0, int r1) throws PDFNetException
r0
- first rotation.r1
- second rotation.PDFNetException
public static int subtractRotations(int r0, int r1) throws PDFNetException
r0
- first rotation.r1
- second rotation.PDFNetException
public static int rotationToDegree(int r) throws PDFNetException
r
- rotation to convert to numberPDFNetException
public static int degreeToRotation(int r) throws PDFNetException
r
- degree to convert to rotation. Valid numbers are multiples of 90.PDFNetException
public int getRotation() throws PDFNetException
PDFNetException
public void setRotation(int rot_type) throws PDFNetException
rot_type
- the new rotationPDFNetException
public double getPageWidth() throws PDFNetException
PDFNetException
public double getPageWidth(int box_type) throws PDFNetException
box_type
- given page bounding typePDFNetException
public double getPageHeight() throws PDFNetException
PDFNetException
public double getPageHeight(int box_type) throws PDFNetException
box_type
- the input bounding box typePDFNetException
public Matrix2D getDefaultMatrix() throws PDFNetException
PDFNetException
public Matrix2D getDefaultMatrix(boolean flip_y, int box_type, int rot_type) throws PDFNetException
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_typePDFNetException
public Obj getAnnots() throws PDFNetException
PDFNetException
public int getNumAnnots() throws PDFNetException
PDFNetException
public Annot getAnnot(int index) throws PDFNetException
index
- The index of the annotation to get on apage. The first annotation
on a page has an index of zero.PDFNetException
public void annotInsert(int pos, Annot annot) throws PDFNetException
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
public void annotPushBack(Annot annot) throws PDFNetException
annot
- - The annotation to prepend in a page's annotation array.PDFNetException
public void annotPushFront(Annot annot) throws PDFNetException
annot
- - The annotation to append in a page's annotation array.PDFNetException
public void annotRemove(Annot annot) throws PDFNetException
Note: Removing the annotation invalidates the given Annot object.
annot
- the annotation to removePDFNetException
public void annotRemove(int index) throws PDFNetException
Note: Removing the annotation invalidates any associated Annot object.
index
- - A zero based index of the annotation to remove.PDFNetException
public void scale(double scale) throws PDFNetException
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
public void flattenField(Field field) throws PDFNetException
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 flattenPDFNetException
public boolean hasTransition() throws PDFNetException
PDFNetException
public double getUserUnitSize() throws PDFNetException
PDFNetException
public void setUserUnitSize(double unit_size) throws PDFNetException
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
public Obj getResourceDict() throws PDFNetException
PDFNetException
public Obj getContents() throws PDFNetException
PDFNetException
public Obj getSDFObj()
public Obj findInheritedAttribute(java.lang.String attrib) throws PDFNetException
attrib
- the inherited attribute to findPDFNetException
public Obj getThumb() throws PDFNetException
Note: If the page does not contain embedded thumbnail information, this method will return null.
PDFNetException
public int[] getThumbInfo() throws PDFNetException
Note: If the page does not contain embedded thumbnail information, this method will return null.
PDFNetException
public static Page __Create(long impl, java.lang.Object ref)
public long __GetHandle()