public class PageTree extends Dictionary
This class represents a document's page tree which defines the ordering of pages in the document. The tree structure allows a user to quickly open a document containing thousands of pages. The tree contains nodes of two types, page tree nodes and page nodes, where page tree nodes are intermediate nodes and pages are leaves. A simple example of this tree structure is a single page tree node that references all of the document's page objects directly.
The page tree is accessible via the document catalog and can be traversed to display a desired page or extracts its content.
| Modifier and Type | Field and Description |
|---|---|
static Name |
COUNT_KEY |
static Name |
CROPBOX_KEY |
protected boolean |
isRotationFactor
Indicates that the PageTree has a rotation factor which should be respected.
|
static Name |
KIDS_KEY |
static Name |
MEDIABOX_KEY |
static Name |
PARENT_KEY |
static Name |
RESOURCES_KEY |
static Name |
ROTATE_KEY |
protected float |
rotationFactor
Inheritable rotation factor by child pages.
|
static Name |
TYPE |
entries, FORM_TYPE_KEY, isDeleted, isNew, LENGTH_KEY, library, SUBTYPE_KEY, TYPE_KEY| Constructor and Description |
|---|
PageTree(Library l,
java.util.HashMap h)
Creates a new instance of a PageTree.
|
| Modifier and Type | Method and Description |
|---|---|
PRectangle |
getCropBox()
Gets the crop box boundary defined by this page tree.
|
PRectangle |
getMediaBox()
Gets the media box boundary defined by this page tree.
|
int |
getNumberOfPages()
In a PDF file there is a root Pages object, which contains
children Page objects, as well as children PageTree objects,
all arranged in a tree.
|
Page |
getPage(int pageNumber)
Gets a Page from the PDF file, locks it for the user,
initializes the Page, and returns it.
|
int |
getPageNumber(Reference r)
Gets the page number of the page specifed by a reference.
|
Reference |
getPageReference(int pageNumber)
Get the page reference for the specified page number.
|
PageTree |
getParent()
Gets the page tree node that is the immediate parent of this one.
|
Resources |
getResources()
Gets the Resources defined by this PageTree.
|
void |
init()
Initiate the PageTree.
|
void |
resetInitializedState()
Reset the pages initialized flag and as a result subsequent calls to
this PageTree may trigger a call to init().
|
protected void |
setWatermarkCallback(WatermarkCallback watermarkCallback)
Sets a page watermark implementation to be painted on top of the page
content.
|
java.lang.String |
toString()
Returns a summary of the PageTree dictionary values.
|
getEntries, getFloat, getInt, getLibrary, getNumber, getObject, getPObjectReference, isDeleted, isNew, setDeleted, setNew, setPObjectReferencepublic static final Name TYPE
public static final Name PARENT_KEY
public static final Name COUNT_KEY
public static final Name MEDIABOX_KEY
public static final Name CROPBOX_KEY
public static final Name KIDS_KEY
public static final Name ROTATE_KEY
public static final Name RESOURCES_KEY
protected float rotationFactor
protected boolean isRotationFactor
public PageTree(Library l, java.util.HashMap h)
l - document library.h - PageTree dictionary entries.public void resetInitializedState()
public void init()
init in class Dictionarypublic PRectangle getMediaBox()
public PRectangle getCropBox()
public Resources getResources()
public PageTree getParent()
public int getPageNumber(Reference r)
r - reference to a page in the page tree.protected void setWatermarkCallback(WatermarkCallback watermarkCallback)
watermarkCallback - watermark implementation.public int getNumberOfPages()
public Page getPage(int pageNumber)
getPage must be matched with
corresponding calls to releasePage.
Calls cannot be nested, meaning that releasePage
must be called before a subsequent invocation of
getPage for the same pageIndex.pageNumber - Zero-based index of the Page to return.public Reference getPageReference(int pageNumber)
pageNumber - zero-based indox of page to find reference of.public java.lang.String toString()
toString in class Dictionary