org.pdfbox.pdmodel.interactive.documentnavigation.outline

Class PDOutlineItem

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.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineNode

node

Constructor Summary

PDOutlineItem()
Default Constructor.
PDOutlineItem(COSDictionary dic)
Constructor for an existing outline item.

Method Summary

PDPage
findDestinationPage(PDDocument doc)
This method will attempt to find the page in this PDF document that this outline points to.
PDAction
getAction()
Get the action of this node.
PDDestination
getDestination()
Get the page destination of this node.
PDOutlineItem
getNextSibling()
Return the next sibling or null if there is no next sibling.
PDOutlineItem
getPreviousSibling()
Return the previous sibling or null if there is no sibling.
PDStructureElement
getStructureElement()
Get the structure element of this node.
PDColorSpaceInstance
getTextColor()
Get the text color of this node.
String
getTitle()
Get the title of this node.
void
insertSiblingAfter(PDOutlineItem item)
Insert a sibling after this node.
boolean
isBold()
A flag telling if the text should be bold.
boolean
isItalic()
A flag telling if the text should be italic.
void
setAction(PDAction action)
Set the action for this node.
void
setBold(boolean bold)
Set the bold property of the text.
void
setDestination(PDPage page)
A convenience method that will create an XYZ destination using only the defaults.
void
setDestination(PDDestination dest)
Set the page destination for this node.
void
setItalic(boolean italic)
Set the italic property of the text.
protected void
setNextSibling(PDOutlineNode outlineNode)
Set the next sibling, this will be maintained by this class.
protected void
setPreviousSibling(PDOutlineNode outlineNode)
Set the previous sibling, this will be maintained by this class.
void
setStructuredElement(PDStructureElement structureElement)
Set the structure element for this node.
void
setTextColor(Color textColor)
Set the text color for this node.
void
setTextColor(PDColorSpaceInstance textColor)
Set the text color for this node.
void
setTitle(String title)
Set the title for this node.

Methods inherited from class org.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineNode

appendChild, closeNode, getCOSDictionary, getCOSObject, getFirstChild, getLastChild, getOpenCount, getParent, isNodeOpen, openNode, setFirstChild, setLastChild, setOpenCount, setParent, updateParentOpenCount

Constructor Details

PDOutlineItem

public PDOutlineItem()
Default Constructor.

PDOutlineItem

public PDOutlineItem(COSDictionary dic)
Constructor for an existing outline item.
Parameters:
dic - The storage dictionary.

Method Details

findDestinationPage

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 methods will throw the OutlineNotLocationException
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.

getAction

public PDAction getAction()
Get the action of this node.
Returns:
The action of this node.

getDestination

public PDDestination getDestination()
            throws IOException
Get the page destination of this node.
Returns:
The page destination of this node.

getNextSibling

public PDOutlineItem getNextSibling()
Return the next sibling or null if there is no next sibling.
Returns:
The next sibling.

getPreviousSibling

public PDOutlineItem getPreviousSibling()
Return the previous sibling or null if there is no sibling.
Returns:
The previous sibling.

getStructureElement

public PDStructureElement getStructureElement()
Get the structure element of this node.
Returns:
The structure element of this node.

getTextColor

public PDColorSpaceInstance 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.

getTitle

public String getTitle()
Get the title of this node.
Returns:
The title of this node.

insertSiblingAfter

public void insertSiblingAfter(PDOutlineItem item)
Insert a sibling after this node.
Parameters:
item - The item to insert.

isBold

public boolean isBold()
A flag telling if the text should be bold.
Returns:
The bold flag.

isItalic

public boolean isItalic()
A flag telling if the text should be italic.
Returns:
The italic flag.

setAction

public void setAction(PDAction action)
Set the action for this node.
Parameters:
action - The new action for this node.

setBold

public void setBold(boolean bold)
Set the bold property of the text.
Parameters:
bold - The new bold flag.

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.

setDestination

public void setDestination(PDDestination dest)
Set the page destination for this node.
Parameters:
dest - The new page destination for this node.

setItalic

public void setItalic(boolean italic)
Set the italic property of the text.
Parameters:
italic - The new italic flag.

setNextSibling

protected void setNextSibling(PDOutlineNode outlineNode)
Set the next sibling, this will be maintained by this class.
Parameters:
outlineNode - The new next sibling.

setPreviousSibling

protected void setPreviousSibling(PDOutlineNode outlineNode)
Set the previous sibling, this will be maintained by this class.
Parameters:
outlineNode - The new previous sibling.

setStructuredElement

public void setStructuredElement(PDStructureElement structureElement)
Set the structure element for this node.
Parameters:
structureElement - The new structure element for this node.

setTextColor

public void setTextColor(Color 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(PDColorSpaceInstance textColor)
Set the text color for this node. The colorspace must be a PDDeviceRGB.
Parameters:
textColor - The text color for this node.

setTitle

public void setTitle(String title)
Set the title for this node.
Parameters:
title - The new title for this node.