intarsys PDF library API

de.intarsys.pdf.pd
Class PDPageTree

java.lang.Object
  extended by de.intarsys.pdf.cos.COSBasedObject
      extended by de.intarsys.pdf.pd.PDObject
          extended by de.intarsys.pdf.pd.PDPageNode
              extended by de.intarsys.pdf.pd.PDPageTree
All Implemented Interfaces:
ICOSObjectListener, IAttributeSupport

public class PDPageTree
extends PDPageNode

A page tree node is a container for pages (and other page tree nodes) within a PFD document. All pages in the document are direct or indirect children of the root page tree node in the COSCatalog object


Nested Class Summary
static class PDPageTree.MetaClass
          The meta class implementation
 
Field Summary
static COSName DK_Count
           
static COSName DK_Kids
           
static PDPageTree.MetaClass META
          The meta class instance
 
Fields inherited from class de.intarsys.pdf.pd.PDPageNode
CN_Type_Page, DK_Pages, DK_Parent, DK_Rotate
 
Fields inherited from class de.intarsys.pdf.pd.PDObject
DK_Subtype, DK_Type
 
Method Summary
 void addNode(int index, PDPageNode newNode)
          Add a page after at the designated index.
 void addNode(PDPageNode newNode)
          Add a page as immediate child at last position
 void addNodeAfter(PDPageNode newNode, PDPageNode destination)
          Add a page after the designated destination page. the destination page must be in the receiver tree node
 int getCount()
          The total number of pages represented by this node.
 PDPageNode getFirstNode()
          Get the first node within the receiver or the receiver if it is not a collection (page tree).
 PDPage getFirstPage()
          Get the first page (leaf node) within the receiver hierarchy.
 List getGenericChildren()
          Get a collection of PDObject children if the receiver is a node in a hierarchical structure (like page nodes or form fields).
 List getKids()
          Get the list of all page nodes that are children of the receiver.
 PDPageNode getLastNode()
          Get the last node within the receiver or the receiver if it is not a collection (page tree).
 void invalidateCaches()
          Invalidate all local caches as the base object may have changed.
 boolean isPage()
          Answer true if this is a single page node.
 PDPageTree rebalance()
          Rebalanve this.
 void removeNode(PDPageNode node)
          Remove a node
 
Methods inherited from class de.intarsys.pdf.pd.PDPageNode
dispose, getCropBox, getFirstAnnotation, getGenericParent, getLastAnnotation, getLastPage, getMediaBox, getNextNode, getNodeIndex, getPageAt, getParent, getPreviousNode, getRotate, setCropBox, setGenericParent, setMediaBox, setRotate
 
Methods inherited from class de.intarsys.pdf.pd.PDObject
cosGetFieldDescendant, cosGetFieldInheritable, cosGetFieldInherited, cosGetSubtype, cosGetType, cosRemoveFieldInheritable, cosSetFieldInheritable, cosSetSubtype, cosSetType, getDoc, toString
 
Methods inherited from class de.intarsys.pdf.cos.COSBasedObject
changed, cosGetArray, cosGetDict, cosGetDoc, cosGetField, cosGetObject, cosGetStream, cosHasField, cosRemoveField, cosSetField, getAttribute, getFieldBoolean, getFieldDate, getFieldFixed, getFieldFixedArray, getFieldInt, getFieldMLString, getFieldString, removeAttribute, setAttribute, setFieldBoolean, setFieldFixed, setFieldInt, setFieldMLString, setFieldName, setFieldObject, setFieldString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

META

public static final PDPageTree.MetaClass META
The meta class instance


DK_Kids

public static final COSName DK_Kids

DK_Count

public static final COSName DK_Count
Method Detail

addNode

public void addNode(int index,
                    PDPageNode newNode)
Add a page after at the designated index.

Parameters:
index - the index which to insert the new child at
newNode - the child page to add

addNode

public void addNode(PDPageNode newNode)
Add a page as immediate child at last position

Parameters:
newNode - the child page to create

addNodeAfter

public void addNodeAfter(PDPageNode newNode,
                         PDPageNode destination)
Add a page after the designated destination page. the destination page must be in the receiver tree node

Parameters:
newNode - the child page to add
destination - the page after which to insert the new child

getCount

public int getCount()
Description copied from class: PDPageNode
The total number of pages represented by this node.

Specified by:
getCount in class PDPageNode
Returns:
The total number of pages represented by this node.

getFirstNode

public PDPageNode getFirstNode()
Description copied from class: PDPageNode
Get the first node within the receiver or the receiver if it is not a collection (page tree).

This may return null if the receiver is an empty collection.

Specified by:
getFirstNode in class PDPageNode
Returns:
Get the first node within the receiver or the receiver if it is not a collection (page tree).

getFirstPage

public PDPage getFirstPage()
Description copied from class: PDPageNode
Get the first page (leaf node) within the receiver hierarchy.

Specified by:
getFirstPage in class PDPageNode
Returns:
Get the first page (leaf node) within the receiver hierarchy.

getGenericChildren

public List getGenericChildren()
Description copied from class: PDObject
Get a collection of PDObject children if the receiver is a node in a hierarchical structure (like page nodes or form fields).

This enables the generic implementation of inherited field values and so on.

A concrete PDObject implementation supporting inheritance should implement this method.

Overrides:
getGenericChildren in class PDObject
Returns:
A collection of PDObject children if the receiver is a node in a hierarchical structure .

getKids

public List getKids()
Get the list of all page nodes that are children of the receiver.

Returns:
an ArrayList

getLastNode

public PDPageNode getLastNode()
Description copied from class: PDPageNode
Get the last node within the receiver or the receiver if it is not a collection (page tree).

This may return null if the receiver is an empty collection.

Specified by:
getLastNode in class PDPageNode
Returns:
Get the last node within the receiver or the receiver if it is not a collection (page tree).

invalidateCaches

public void invalidateCaches()
Description copied from class: COSBasedObject
Invalidate all local caches as the base object may have changed.

Overrides:
invalidateCaches in class PDPageNode

isPage

public boolean isPage()
Description copied from class: PDPageNode
Answer true if this is a single page node.

Specified by:
isPage in class PDPageNode
Returns:
Answer true if this is a single page node.

rebalance

public PDPageTree rebalance()
Rebalanve this.

Returns:
The new PDPageTree created or null if nothing changed.

removeNode

public void removeNode(PDPageNode node)
Remove a node

Parameters:
node - The child node to remove

intarsys PDF library API

Copyright © 2006 intarsys consulting GmbH. All Rights Reserved.