org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline

## Class PDOutlineItem

- java.lang.Object
- - org.apache.pdfbox.pdmodel.common.PDDictionaryWrapper
  - - org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineNode
    - - org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem

All Implemented Interfaces:
  COSObjectable

    public final class PDOutlineItem
    extends PDOutlineNode

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

Constructors
Constructor and Description
`PDOutlineItem()` Default Constructor.
`PDOutlineItem(COSDictionary dic)` Constructor for an existing outline item.

### Method Summary

All Methods Instance Methods Concrete Methods
`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()`
`PDOutlineItem` `getPreviousSibling()` Return the previous sibling or null if there is no sibling.
`PDStructureElement` `getStructureElement()` Get the structure element of this node.
`PDColor` `getTextColor()` Get the RGB text color of this node.
`String` `getTitle()` Get the title of this node.
`void` `insertSiblingAfter(PDOutlineItem newSibling)` Insert a single sibling after this node.
`void` `insertSiblingBefore(PDOutlineItem newSibling)` Insert a single sibling before 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(PDDestination dest)` Set the page destination for this node.
`void` `setDestination(PDPage page)` A convenience method that will create an XYZ destination using only the defaults.
`void` `setItalic(boolean italic)` Set the italic property of the text.
`void` `setStructureElement(PDStructureElement structureElement)` Set the structure element for this node.
`void` `setTextColor(Color textColor)` Set the RGB text color for this node.
`void` `setTextColor(PDColor textColor)` Set the RGB text color for this node.
`void` `setTitle(String title)` Set the title for this node.

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

`addFirst, addLast, children, closeNode, getFirstChild, getLastChild, getOpenCount, hasChildren, isNodeOpen, openNode`

### Methods inherited from class org.apache.pdfbox.pdmodel.common.PDDictionaryWrapper

`equals, getCOSObject, hashCode`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

### 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 newSibling)

Insert a single sibling after this node.

Parameters:
  `newSibling` - The item to insert.
Throws:
  `IllegalArgumentException` - if the given sibling node is part of a list (i.e. if it has a previous or a next sibling)

#### insertSiblingBefore

    public void insertSiblingBefore(PDOutlineItem newSibling)

Insert a single sibling before this node.

Parameters:
  `newSibling` - The item to insert.
Throws:
  `IllegalArgumentException` - if the given sibling node is part of a list (i.e. if it has a previous or a next sibling)

#### getPreviousSibling

    public PDOutlineItem getPreviousSibling()

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

Returns:
  The previous sibling.

#### getNextSibling

    public PDOutlineItem getNextSibling()

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

#### getTitle

    public String getTitle()

Get the title of this node.

Returns:
  The title of this node.

#### setTitle

    public void setTitle(String title)

Set the title for this node.

Parameters:
  `title` - The new title for this node.

#### getDestination

    public PDDestination getDestination()
                                 throws IOException

Get the page destination of this node.

Returns:
  The page destination of this node.
Throws:
  `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 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:
  `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.

#### setStructureElement

    public void setStructureElement(PDStructureElement structureElement)

Set the structure element for this node.

Parameters:
  `structureElement` - The new structure element for this node.

#### getTextColor

    public PDColor 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

    public void setTextColor(PDColor textColor)

Set the RGB text color for this node.

Parameters:
  `textColor` - The text color for this node.

#### setTextColor

    public void setTextColor(Color textColor)

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.