org.pdfbox.pdmodel.interactive.documentnavigation.outline
Class PDOutlineNode
java.lang.Object
org.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineNode
- COSObjectable
public class PDOutlineNode
extends java.lang.Object
This represents an node in an outline in a pdf document.
PDOutlineNode
public PDOutlineNode()
Default Constructor.
PDOutlineNode
public PDOutlineNode(COSDictionary dict)
Default Constructor.
dict
- The dictionary storage.
appendChild
public void appendChild(PDOutlineItem outlineNode)
append a child node to this node.
outlineNode
- The node to add.
closeNode
public void closeNode()
Close this node.
getCOSDictionary
public COSDictionary getCOSDictionary()
Convert this standard java object to a COS object.
- The cos object that matches this Java object.
getCOSObject
public COSBase getCOSObject()
Convert this standard java object to a COS object.
- getCOSObject in interface COSObjectable
- The cos object that matches this Java object.
getFirstChild
public PDOutlineItem getFirstChild()
Return the first child or null if there is no child.
getLastChild
public PDOutlineItem getLastChild()
Return the last child or null if there is no child.
getOpenCount
public int getOpenCount()
Get the number of open nodes. Or a negative number if this node
is closed. See PDF Reference for more details. This value
is updated as you append children and siblings.
- The Count attribute of the outline dictionary.
getParent
public PDOutlineNode getParent()
Get the parent of this object. This will either be a DocumentOutline or an OutlineItem.
- The parent of this object, or null if this is the document outline and there
is no parent.
isNodeOpen
public boolean isNodeOpen()
Node is open if the open count is greater than zero.
- true if this node is open.
openNode
public void openNode()
This will set this node to be open when it is shown in the viewer. By default, when
a new node is created it will be closed.
This will do nothing if the node is already open.
setFirstChild
protected void setFirstChild(PDOutlineNode outlineNode)
Set the first child, this will be maintained by this class.
outlineNode
- The new first child.
setLastChild
protected void setLastChild(PDOutlineNode outlineNode)
Set the last child, this will be maintained by this class.
outlineNode
- The new last child.
setOpenCount
protected void setOpenCount(int openCount)
Set the open count. This number is automatically managed for you
when you add items to the outline.
openCount
- The new open cound.
setParent
protected void setParent(PDOutlineNode parent)
Set the parent of this object, this is maintained by these objects and should not
be called by any clients of PDFBox code.
parent
- The parent of this object.
updateParentOpenCount
protected void updateParentOpenCount(int amount)
The count parameter needs to be updated when you add or remove elements to
the outline. When you add an element at a lower level then you need to
increase all of the parents.
amount
- The amount to update by.