Package com.itextpdf.kernel.pdf
Class PdfOutline
java.lang.Object
com.itextpdf.kernel.pdf.PdfOutline
Document outline object
See ISO-320001, 12.3.3 Document Outline.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List
<PdfOutline> private PdfDictionary
private PdfDestination
static final int
A flag for displaying the outline item’s text with bold font.static final int
A flag for displaying the outline item’s text with italic font.private PdfOutline
private PdfDocument
private String
-
Constructor Summary
ConstructorsConstructorDescriptionPdfOutline
(PdfDocument doc) This constructor creates root outline in the document.PdfOutline
(String title, PdfDictionary content, PdfDocument pdfDocument) Create instance of document outline.PdfOutline
(String title, PdfDictionary content, PdfOutline parent) Create instance of document outline. -
Method Summary
Modifier and TypeMethodDescriptionvoid
AddsPdfAction
for the outline,A
key.void
addDestination
(PdfDestination destination) AddsPdfDestination
for the outline,Dest
key.addOutline
(PdfOutline outline) Adds anPdfOutline
as a child to existingPdfOutline
and put it to the end of the existingPdfOutline
children list.addOutline
(String title) Adds anPdfOutline
as a child to existingPdfOutline
and put it in the end of the existingPdfOutline
children list.addOutline
(String title, int position) Adds a newPdfOutline
with specified parameters as a child to existingPdfOutline
and put it to specified position in the existingPdfOutline
children list.(package private) void
clear()
Clear list of children.Gets list of children outlines.getColor()
Gets color for the outline entry's text,C
key.Gets content dictionary.GetsPdfDestination
.private PdfDictionary
Gets the Outline root inpdfDoc
's catalog entryGets parent outline.getStyle()
Gets text style for the outline entry's text,F
key.getTitle()
Gets title of the outline.boolean
isOpen()
Defines if the outline is open or closed.private boolean
Determines if the currentPdfOutline
object is the Outline Root.void
Remove this outline from the document.void
Sets color for the outline entry’s text,C
key.(package private) void
setDestination
(PdfDestination destination) SetsPdfDestination
.void
setOpen
(boolean open) Defines if the outline needs to be closed or not.void
setStyle
(int style) Sets text style for the outline entry’s text,F
key.void
Sets title of the outline withPdfEncodings.UNICODE_BIG
encoding,Title
key.
-
Field Details
-
FLAG_ITALIC
public static final int FLAG_ITALICA flag for displaying the outline item’s text with italic font.- See Also:
-
FLAG_BOLD
public static final int FLAG_BOLDA flag for displaying the outline item’s text with bold font.- See Also:
-
children
-
title
-
-
destination
-
parent
-
pdfDoc
-
-
Constructor Details
-
PdfOutline
PdfOutline(String title, PdfDictionary content, PdfDocument pdfDocument) Create instance of document outline.- Parameters:
title
- the text that shall be displayed on the screen for this item.content
- Outline dictionarypdfDocument
-PdfDocument
the outline belongs to.
-
PdfOutline
PdfOutline(String title, PdfDictionary content, PdfOutline parent) Create instance of document outline.- Parameters:
title
- the text that shall be displayed on the screen for this item.content
- Outline dictionaryparent
- parent outline.addOutline(String, int)
andaddOutline(String)
instead.
-
PdfOutline
PdfOutline(PdfDocument doc) This constructor creates root outline in the document.- Parameters:
doc
-PdfDocument
-
-
Method Details
-
getTitle
Gets title of the outline.- Returns:
- String value.
-
setTitle
Sets title of the outline withPdfEncodings.UNICODE_BIG
encoding,Title
key.- Parameters:
title
- String value.
-
setColor
Sets color for the outline entry’s text,C
key.- Parameters:
color
-Color
-
getColor
Gets color for the outline entry's text,C
key.- Returns:
- color
Color
.
-
setStyle
public void setStyle(int style) Sets text style for the outline entry’s text,F
key.- Parameters:
style
- Could be eitherFLAG_BOLD
orFLAG_ITALIC
. Default value is0
.
-
getStyle
Gets text style for the outline entry's text,F
key.- Returns:
- style value.
-
getContent
Gets content dictionary.- Returns:
PdfDictionary
.
-
getAllChildren
Gets list of children outlines.- Returns:
- List of
PdfOutline
.
-
getParent
Gets parent outline.- Returns:
PdfOutline
.
-
getDestination
GetsPdfDestination
.- Returns:
PdfDestination
.
-
addAction
AddsPdfAction
for the outline,A
key.- Parameters:
action
- instance ofPdfAction
.
-
setOpen
public void setOpen(boolean open) Defines if the outline needs to be closed or not. By default, outlines are open.- Parameters:
open
- if false, the outline will be closed by default
-
isOpen
public boolean isOpen()Defines if the outline is open or closed.- Returns:
- true if open,false otherwise.
-
addOutline
Adds a newPdfOutline
with specified parameters as a child to existingPdfOutline
and put it to specified position in the existingPdfOutline
children list.- Parameters:
title
- an outline titleposition
- a position in the current outline child List where a new outline should be added. If the position equals -1, then the outline will be put in the end of children list.- Returns:
- just created outline
-
addOutline
Adds anPdfOutline
as a child to existingPdfOutline
and put it in the end of the existingPdfOutline
children list.- Parameters:
title
- an outline title- Returns:
- just created outline
-
addOutline
Adds anPdfOutline
as a child to existingPdfOutline
and put it to the end of the existingPdfOutline
children list.- Parameters:
outline
- an outline to add.- Returns:
- just created outline
-
removeOutline
public void removeOutline()Remove this outline from the document. Outlines that are children of this outline are removed recursively -
clear
void clear()Clear list of children. -
getOutlineRoot
Gets the Outline root inpdfDoc
's catalog entry- Returns:
- The
PdfDictionary
of the document's Outline root, ornull
if it can't be found.
-
isOutlineRoot
private boolean isOutlineRoot()Determines if the currentPdfOutline
object is the Outline Root.- Returns:
false
if this is not the outline root or the root can not be found,true
otherwise.
-