Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline

public final Class PDOutlineItem

extends PDOutlineNode
Class Inheritance
Imports
java.awt.Color, java.io.IOException, org.apache.pdfbox.cos.COSArray, .COSDictionary, .COSFloat, .COSName, org.apache.pdfbox.pdmodel.PDDocument, .PDPage, org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureElement, org.apache.pdfbox.pdmodel.graphics.color.PDColor, .PDDeviceRGB, org.apache.pdfbox.pdmodel.interactive.action.PDActionFactory, .PDAction, .PDActionGoTo, org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDDestination, .PDNamedDestination, .PDPageDestination, .PDPageXYZDestination

This represents an outline item in a pdf document. The items at each level of the hierarchy form an iterable linked list, chained together through their Prev and Next entries.
Author
Ben Litchfield

Field Summary

Modifier and TypeField and Description
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
public
PDOutlineItem()

Default Constructor.

public
PDOutlineItem(COSDictionary
The storage dictionary.
dic
)

Constructor for an existing outline item.

Method Summary

Modifier and TypeMethod and Description
public PDPage

Returns:

The page that this outline will go to when activated or null if it does not point to anything.
findDestinationPage
(PDDocument
The document to get the page from.
doc
)

This method will attempt to find the page in this PDF document that this outline points to.

public PDAction

Returns:

The action of this node.
getAction
()

Get the action of this node.

public PDDestination

Returns:

The page destination of this node.
getDestination
()

Get the page destination of this node.

public PDOutlineItem

Returns:

The next sibling or null if there is no next sibling.
getNextSibling
()

public PDOutlineItem

Returns:

The previous sibling.
getPreviousSibling
()

Return the previous sibling or null if there is no sibling.

public PDStructureElement

Returns:

The structure element of this node.
getStructureElement
()

Get the structure element of this node.

public PDColor

Returns:

The structure element of this node.
getTextColor
()

Get the RGB text color of this node.

public String

Returns:

The title of this node.
getTitle
()

Get the title of this node.

public void
insertSiblingAfter(PDOutlineItem
The item to insert.
newSibling
)

Insert a single sibling after this node.

public void
insertSiblingBefore(PDOutlineItem
The item to insert.
newSibling
)

Insert a single sibling before this node.

public boolean

Returns:

The bold flag.
isBold
()

A flag telling if the text should be bold.

public boolean

Returns:

The italic flag.
isItalic
()

A flag telling if the text should be italic.

public void
setAction(PDAction
The new action for this node.
action
)

Set the action for this node.

public void
setBold(boolean
The new bold flag.
bold
)

Set the bold property of the text.

public void
setDestination(PDDestination
The new page destination for this node.
dest
)

Set the page destination for this node.

public void
setDestination(PDPage
The page to refer to.
page
)

A convenience method that will create an XYZ destination using only the defaults.

public void
setItalic(boolean
The new italic flag.
italic
)

Set the italic property of the text.

pack-priv void
setNextSibling(PDOutlineNode
The new next sibling.
outlineNode
)

Set the next sibling, this will be maintained by this class.

pack-priv void
setPreviousSibling(PDOutlineNode
The new previous sibling.
outlineNode
)

Set the previous sibling, this will be maintained by this class.

public void
setStructureElement(PDStructureElement
The new structure element for this node.
structureElement
)

Set the structure element for this node.

public void
setTextColor(PDColor
The text color for this node.
textColor
)

Set the RGB text color for this node.

public void
setTextColor(Color
The text color for this node.
textColor
)

Set the RGB text color for this node.

public void
setTitle(String
The new title for this node.
title
)

Set the title for this node.

Inherited from org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineNode:
addFirstaddLastchildrencloseNodegetFirstChildgetLastChildgetOpenCountgetOutlineItemgetParenthasChildrenisNodeOpenopenNoderequireSingleNodesetFirstChildsetLastChildsetOpenCountsetParentupdateParentOpenCountupdateParentOpenCountForAddedChild

Field Detail

BOLD_FLAGback to summary
private static final int BOLD_FLAG
ITALIC_FLAGback to summary
private static final int ITALIC_FLAG

Constructor Detail

PDOutlineItemback to summary
public PDOutlineItem()

Default Constructor.

PDOutlineItemback to summary
public PDOutlineItem(COSDictionary dic)

Constructor for an existing outline item.

Parameters
dic:COSDictionary

The storage dictionary.

Method Detail

findDestinationPageback to summary
public PDPage findDestinationPage(PDDocument doc) throws 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:PDDocument

The document to get the page from.

Returns:PDPage

The page that this outline will go to when activated or null if it does not point to anything.

Exceptions
IOException:
If there is an error when trying to find the page.
getActionback to summary
public PDAction getAction()

Get the action of this node.

Returns:PDAction

The action of this node.

getDestinationback to summary
public PDDestination getDestination() throws IOException

Get the page destination of this node.

Returns:PDDestination

The page destination of this node.

Exceptions
IOException:
If there is an error creating the destination.
getNextSiblingback to summary
public PDOutlineItem getNextSibling()
Returns:PDOutlineItem

The next sibling or null if there is no next sibling.

getPreviousSiblingback to summary
public PDOutlineItem getPreviousSibling()

Return the previous sibling or null if there is no sibling.

Returns:PDOutlineItem

The previous sibling.

getStructureElementback to summary
public PDStructureElement getStructureElement()

Get the structure element of this node.

Returns:PDStructureElement

The structure element of this node.

getTextColorback to summary
public PDColor getTextColor()

Get the RGB text color of this node. Default is black and this method will never return null.

Returns:PDColor

The structure element of this node.

getTitleback to summary
public String getTitle()

Get the title of this node.

Returns:String

The title of this node.

insertSiblingAfterback to summary
public void insertSiblingAfter(PDOutlineItem newSibling)

Insert a single sibling after this node.

Parameters
newSibling:PDOutlineItem

The item to insert.

Exceptions
IllegalArgumentException:
if the given sibling node is part of a list (i.e. if it has a previous or a next sibling)
insertSiblingBeforeback to summary
public void insertSiblingBefore(PDOutlineItem newSibling)

Insert a single sibling before this node.

Parameters
newSibling:PDOutlineItem

The item to insert.

Exceptions
IllegalArgumentException:
if the given sibling node is part of a list (i.e. if it has a previous or a next sibling)
isBoldback to summary
public boolean isBold()

A flag telling if the text should be bold.

Returns:boolean

The bold flag.

isItalicback to summary
public boolean isItalic()

A flag telling if the text should be italic.

Returns:boolean

The italic flag.

setActionback to summary
public void setAction(PDAction action)

Set the action for this node.

Parameters
action:PDAction

The new action for this node.

setBoldback to summary
public void setBold(boolean bold)

Set the bold property of the text.

Parameters
bold:boolean

The new bold flag.

setDestinationback to summary
public void setDestination(PDDestination dest)

Set the page destination for this node.

Parameters
dest:PDDestination

The new page destination for this node.

setDestinationback to summary
public void setDestination(PDPage page)

A convenience method that will create an XYZ destination using only the defaults.

Parameters
page:PDPage

The page to refer to.

setItalicback to summary
public void setItalic(boolean italic)

Set the italic property of the text.

Parameters
italic:boolean

The new italic flag.

setNextSiblingback to summary
pack-priv void setNextSibling(PDOutlineNode outlineNode)

Set the next sibling, this will be maintained by this class.

Parameters
outlineNode:PDOutlineNode

The new next sibling.

setPreviousSiblingback to summary
pack-priv void setPreviousSibling(PDOutlineNode outlineNode)

Set the previous sibling, this will be maintained by this class.

Parameters
outlineNode:PDOutlineNode

The new previous sibling.

setStructureElementback to summary
public void setStructureElement(PDStructureElement structureElement)

Set the structure element for this node.

Parameters
structureElement:PDStructureElement

The new structure element for this node.

setTextColorback to summary
public void setTextColor(PDColor textColor)

Set the RGB text color for this node.

Parameters
textColor:PDColor

The text color for this node.

setTextColorback to summary
public void setTextColor(Color textColor)

Set the RGB text color for this node.

Parameters
textColor:Color

The text color for this node.

setTitleback to summary
public void setTitle(String title)

Set the title for this node.

Parameters
title:String

The new title for this node.