Class PDOutlineItem
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineNode
-
- org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem
-
- All Implemented Interfaces:
COSObjectable
public class PDOutlineItem extends PDOutlineNode
This represents an outline in a pdf document.- Version:
- $Revision: 1.7 $
- Author:
- Ben Litchfield
-
-
Field Summary
-
Fields inherited from class org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineNode
node
-
-
Constructor Summary
Constructors Constructor Description PDOutlineItem()Default Constructor.PDOutlineItem(COSDictionary dic)Constructor for an existing outline item.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PDPagefindDestinationPage(PDDocument doc)This method will attempt to find the page in this PDF document that this outline points to.PDActiongetAction()Get the action of this node.PDDestinationgetDestination()Get the page destination of this node.PDOutlineItemgetNextSibling()Return the next sibling or null if there is no next sibling.PDOutlineNodegetParent()Get the parent of this object.PDOutlineItemgetPreviousSibling()Return the previous sibling or null if there is no sibling.PDStructureElementgetStructureElement()Get the structure element of this node.PDColorStategetTextColor()Get the text color of this node.java.lang.StringgetTitle()Get the title of this node.voidinsertSiblingAfter(PDOutlineItem item)Insert a sibling after this node.booleanisBold()A flag telling if the text should be bold.booleanisItalic()A flag telling if the text should be italic.voidsetAction(PDAction action)Set the action for this node.voidsetBold(boolean bold)Set the bold property of the text.voidsetDestination(PDDestination dest)Set the page destination for this node.voidsetDestination(PDPage page)A convenience method that will create an XYZ destination using only the defaults.voidsetItalic(boolean italic)Set the italic property of the text.protected voidsetNextSibling(PDOutlineNode outlineNode)Set the next sibling, this will be maintained by this class.protected voidsetPreviousSibling(PDOutlineNode outlineNode)Set the previous sibling, this will be maintained by this class.voidsetStructuredElement(PDStructureElement structureElement)Set the structure element for this node.voidsetTextColor(java.awt.Color textColor)Set the text color for this node.voidsetTextColor(PDColorState textColor)Set the text color for this node.voidsetTitle(java.lang.String title)Set the title for this node.-
Methods inherited from class org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineNode
appendChild, closeNode, getCOSDictionary, getCOSObject, getFirstChild, getLastChild, getOpenCount, isNodeOpen, openNode, setFirstChild, setLastChild, setOpenCount, setParent, updateParentOpenCount
-
-
-
-
Constructor Detail
-
PDOutlineItem
public PDOutlineItem()
Default Constructor.
-
PDOutlineItem
public PDOutlineItem(COSDictionary dic)
Constructor for an existing outline item.- Parameters:
dic- The storage dictionary.
-
-
Method Detail
-
insertSiblingAfter
public void insertSiblingAfter(PDOutlineItem item)
Insert a sibling after this node.- Parameters:
item- The item to insert.
-
getParent
public PDOutlineNode getParent()
Get the parent of this object. This will either be a DocumentOutline or an OutlineItem.- Overrides:
getParentin classPDOutlineNode- Returns:
- The parent of this object, or null if this is the document outline and there is no parent.
-
getPreviousSibling
public PDOutlineItem getPreviousSibling()
Return the previous sibling or null if there is no sibling.- Returns:
- The previous sibling.
-
setPreviousSibling
protected void setPreviousSibling(PDOutlineNode outlineNode)
Set the previous sibling, this will be maintained by this class.- Parameters:
outlineNode- The new previous sibling.
-
getNextSibling
public PDOutlineItem getNextSibling()
Return the next sibling or null if there is no next sibling.- Returns:
- The next sibling.
-
setNextSibling
protected void setNextSibling(PDOutlineNode outlineNode)
Set the next sibling, this will be maintained by this class.- Parameters:
outlineNode- The new next sibling.
-
getTitle
public java.lang.String getTitle()
Get the title of this node.- Returns:
- The title of this node.
-
setTitle
public void setTitle(java.lang.String title)
Set the title for this node.- Parameters:
title- The new title for this node.
-
getDestination
public PDDestination getDestination() throws java.io.IOException
Get the page destination of this node.- Returns:
- The page destination of this node.
- Throws:
java.io.IOException- If there is an error creating the destination.
-
setDestination
public void setDestination(PDDestination dest)
Set the page destination for this node.- Parameters:
dest- The new page destination for this node.
-
setDestination
public void setDestination(PDPage page)
A convenience method that will create an XYZ destination using only the defaults.- Parameters:
page- The page to refer to.
-
findDestinationPage
public PDPage findDestinationPage(PDDocument doc) throws java.io.IOException
This method will attempt to find the page in this PDF document that this outline points to. If the outline does not point to anything then this method will return null. If the outline is an action that is not a GoTo action then this method will also return null.- Parameters:
doc- The document to get the page from.- Returns:
- The page that this outline will go to when activated or null if it does not point to anything.
- Throws:
java.io.IOException- If there is an error when trying to find the page.
-
getAction
public PDAction getAction()
Get the action of this node.- Returns:
- The action of this node.
-
setAction
public void setAction(PDAction action)
Set the action for this node.- Parameters:
action- The new action for this node.
-
getStructureElement
public PDStructureElement getStructureElement()
Get the structure element of this node.- Returns:
- The structure element of this node.
-
setStructuredElement
public void setStructuredElement(PDStructureElement structureElement)
Set the structure element for this node.- Parameters:
structureElement- The new structure element for this node.
-
getTextColor
public PDColorState getTextColor()
Get the text color of this node. Default is black and this method will never return null.- Returns:
- The structure element of this node.
-
setTextColor
public void setTextColor(PDColorState textColor)
Set the text color for this node. The colorspace must be a PDDeviceRGB.- Parameters:
textColor- The text color for this node.
-
setTextColor
public void setTextColor(java.awt.Color textColor)
Set the text color for this node. The colorspace must be a PDDeviceRGB.- Parameters:
textColor- The text color for this node.
-
isItalic
public boolean isItalic()
A flag telling if the text should be italic.- Returns:
- The italic flag.
-
setItalic
public void setItalic(boolean italic)
Set the italic property of the text.- Parameters:
italic- The new italic flag.
-
isBold
public boolean isBold()
A flag telling if the text should be bold.- Returns:
- The bold flag.
-
setBold
public void setBold(boolean bold)
Set the bold property of the text.- Parameters:
bold- The new bold flag.
-
-