com.etymon.pjx.util
Class PdfPageTree

java.lang.Object
  extended by com.etymon.pjx.util.PdfPageTree

public class PdfPageTree
extends java.lang.Object

Provides methods for retrieving and modifying the page tree of a PDF document. This class is synchronized.


Field Summary
protected  PdfCatalog _catalog
          The catalog associated with this document.
protected static java.util.Set _inheritable
          Defines the set of inheritable field attributes.
protected  PdfManager _m
          The manager associated with this document.
protected  PdfReference _pageTreeRoot
          The page tree root of the document.
protected static PdfName PDFNAME_COUNT
           
protected static PdfName PDFNAME_KIDS
           
protected static PdfName PDFNAME_PAGE
           
protected static PdfName PDFNAME_PAGES
           
protected static PdfName PDFNAME_PARENT
           
protected static PdfName PDFNAME_TYPE
           
 
Constructor Summary
PdfPageTree(PdfManager manager)
          Constructs a PdfPageTree instance based on a specified PdfManager.
 
Method Summary
 int getNumberOfPages()
          Returns the number of pages in the document.
 PdfReference getPage(int pageNumber)
          Returns an indirect reference to a page object specified by page number.
 PdfReference getRoot()
          Returns an indirect reference to the root node of the document's page tree.
 PdfDictionary inheritAttributes(PdfDictionary page)
          Adds inherited attributes to a specified page dictionary object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_pageTreeRoot

protected PdfReference _pageTreeRoot
The page tree root of the document.


_m

protected PdfManager _m
The manager associated with this document.


_catalog

protected PdfCatalog _catalog
The catalog associated with this document.


_inheritable

protected static java.util.Set _inheritable
Defines the set of inheritable field attributes.


PDFNAME_COUNT

protected static final PdfName PDFNAME_COUNT

PDFNAME_KIDS

protected static final PdfName PDFNAME_KIDS

PDFNAME_PAGE

protected static final PdfName PDFNAME_PAGE

PDFNAME_PAGES

protected static final PdfName PDFNAME_PAGES

PDFNAME_PARENT

protected static final PdfName PDFNAME_PARENT

PDFNAME_TYPE

protected static final PdfName PDFNAME_TYPE
Constructor Detail

PdfPageTree

public PdfPageTree(PdfManager manager)
Constructs a PdfPageTree instance based on a specified PdfManager.

Method Detail

getPage

public PdfReference getPage(int pageNumber)
                     throws java.io.IOException,
                            PdfFormatException
Returns an indirect reference to a page object specified by page number. Note that page objects do not include inherited attributes; inheritAttributes(PdfDictionary) should be used to obtain inherited attributes.

Parameters:
pageNumber - the page number. The numbering starts with 0.
Returns:
the indirect reference.
Throws:
java.io.IOException
PdfFormatException

getNumberOfPages

public int getNumberOfPages()
                     throws java.io.IOException,
                            PdfFormatException
Returns the number of pages in the document.

Returns:
the number of pages.
Throws:
java.io.IOException
PdfFormatException

getRoot

public PdfReference getRoot()
                     throws java.io.IOException,
                            PdfFormatException
Returns an indirect reference to the root node of the document's page tree.

Returns:
the indirect reference.
Throws:
java.io.IOException
PdfFormatException

inheritAttributes

public PdfDictionary inheritAttributes(PdfDictionary page)
                                throws java.io.IOException,
                                       PdfFormatException
Adds inherited attributes to a specified page dictionary object. The page object is cloned and the inherited attributes are made explicit in the cloned object's dictionary. The inherited attributes are retrieved by ascending the page tree and looking for inheritable attributes (if any) that are missing from the specified page dictionary.

Parameters:
page - the page dictionary to be filled in with inherited attributes.
Returns:
a clone of the specified page dictionary, with all inherited attributes filled in.
Throws:
java.io.IOException
PdfFormatException