Module org.sejda.sambox
Class PDOutlineItem
java.lang.Object
org.sejda.sambox.pdmodel.common.PDDictionaryWrapper
org.sejda.sambox.pdmodel.interactive.documentnavigation.outline.PDOutlineNode
org.sejda.sambox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem
- All Implemented Interfaces:
COSObjectable,WithActionOrDestination
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
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for an existing outline item. -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete()This method will attempt to find the page in this PDF document that this outline points to.Get the action of this node.Get the page destination of this node.Return the previous sibling or null if there is no sibling.Get the structure element of this node.Get the RGB text color of this node.getTitle()Get the title of this node.voidinsertSiblingAfter(PDOutlineItem newSibling) Insert a single sibling after this node.voidinsertSiblingBefore(PDOutlineItem newSibling) Insert a single sibling before this node.booleanisBold()A flag telling if the text should be bold.booleanisItalic()A flag telling if the text should be italic.voidSet 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.voidsetStructureElement(PDStructureElement structureElement) Set the structure element for this node.voidsetTextColor(Color textColor) Set the RGB text color for this node.voidsetTextColor(PDColor textColor) Set the RGB text color for this node.voidSet the title for this node.Methods inherited from class org.sejda.sambox.pdmodel.interactive.documentnavigation.outline.PDOutlineNode
addAtPosition, addFirst, addLast, children, closeNode, getFirstChild, getLastChild, getOpenCount, hasChildren, isNodeOpen, openNodeMethods inherited from class org.sejda.sambox.pdmodel.common.PDDictionaryWrapper
equals, getCOSObject, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.sejda.sambox.cos.COSObjectable
getCOSObjectMethods inherited from interface org.sejda.sambox.pdmodel.interactive.documentnavigation.destination.WithActionOrDestination
resolveToPageDestination
-
Constructor Details
-
PDOutlineItem
public PDOutlineItem() -
PDOutlineItem
Constructor for an existing outline item.- Parameters:
dic- The storage dictionary.
-
-
Method Details
-
getPreviousSibling
Return the previous sibling or null if there is no sibling.- Returns:
- The previous sibling.
-
getNextSibling
- Returns:
- The next sibling or null if there is no next sibling.
-
getTitle
Get the title of this node.- Returns:
- The title of this node.
-
setTitle
Set the title for this node.- Parameters:
title- The new title for this node.
-
getDestination
Get the page destination of this node.- Specified by:
getDestinationin interfaceWithActionOrDestination- Returns:
- The page destination of this node.
- Throws:
IOException- If there is an error creating the destination.
-
setDestination
A convenience method that will create an XYZ destination using only the defaults.- Parameters:
page- The page to refer to.
-
findDestinationPage
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:
IOException- If there is an error when trying to find the page.
-
getAction
Get the action of this node.- Specified by:
getActionin interfaceWithActionOrDestination- Returns:
- The action of this node.
-
setAction
Set the action for this node.- Parameters:
action- The new action for this node.
-
getStructureElement
Get the structure element of this node.- Returns:
- The structure element of this node.
-
setStructureElement
Set the structure element for this node.- Parameters:
structureElement- The new structure element for this node.
-
getTextColor
Get the RGB text color of this node. Default is black and this method will never return null.- Returns:
- The structure element of this node.
-
setTextColor
Set the RGB text color for this node.- Parameters:
textColor- The text color for this node.
-
setTextColor
Set the RGB text color for this node.- 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.
-
delete
public void delete()