Class PDFOutline
- java.lang.Object
-
- pdf.PDFObject
-
- pdf.PDFOutline
-
- All Implemented Interfaces:
java.io.Serializable
public class PDFOutline extends PDFObject implements java.io.Serializable
This class manages the documents outlines (also known as bookmarks).- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected PDFOutlineparentFor subentries, this points to it's parent outline-
Fields inherited from class pdf.PDFObject
objser, pdfDocument
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPDFOutline()Constructs a PDF Outline object.PDFOutline(java.lang.String title, PDFPage dest)Constructs a PDF Outline object.PDFOutline(java.lang.String title, PDFPage dest, int l, int b, int r, int t)Constructs a PDF Outline object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PDFOutlineadd(java.lang.String title, PDFPage dest)This method creates an outline, and attaches it to this one.PDFOutlineadd(java.lang.String title, PDFPage dest, int x, int y, int w, int h)This method creates an outline, and attaches it to this one.voidadd(PDFOutline outline)This adds an already existing outline to this one.protected intdescendants()Returns the total number of descendants below this one.java.util.Enumeration<PDFOutline>elements()Returns all outlines directly below this one.protected intgetIndex(PDFOutline outline)This is called by children to find their position in this outlines tree.protected intgetLast()Returns the last index in this outlineprotected PDFOutlinegetNode(int i)Returns the outline at a specified position.voidwrite(java.io.OutputStream os)Writes the object to the output stream.-
Methods inherited from class pdf.PDFObject
getPDFDocument, getSerialID, getType, toArray, toString, writeEnd, writeStart
-
-
-
-
Field Detail
-
parent
protected PDFOutline parent
For subentries, this points to it's parent outline
-
-
Constructor Detail
-
PDFOutline
protected PDFOutline()
Constructs a PDF Outline object. This method is used internally only.
-
PDFOutline
public PDFOutline(java.lang.String title, PDFPage dest)Constructs a PDF Outline object. When selected, the whole page is displayed.- Parameters:
title- Title of the outlinedest- The destination page
-
PDFOutline
public PDFOutline(java.lang.String title, PDFPage dest, int l, int b, int r, int t)Constructs a PDF Outline object. When selected, the specified region is displayed.- Parameters:
title- Title of the outlinedest- The destination pagel- left coordinateb- bottom coordinater- right coordinatet- top coordinate
-
-
Method Detail
-
add
public PDFOutline add(java.lang.String title, PDFPage dest)
This method creates an outline, and attaches it to this one. When the outline is selected, the entire page is displayed.This allows you to have an outline for say a Chapter, then under the chapter, one for each section. You are not really limited on how deep you go, but it's best not to go below say 6 levels, for the reader's sake.
- Parameters:
title- Title of the outlinedest- The destination page- Returns:
- PDFOutline object created, for creating sub-outlines
-
add
public PDFOutline add(java.lang.String title, PDFPage dest, int x, int y, int w, int h)
This method creates an outline, and attaches it to this one. When the outline is selected, the supplied region is displayed.Note: the coordiates are in Java space. They are converted to User space.
This allows you to have an outline for say a Chapter, then under the chapter, one for each section. You are not really limited on how deep you go, but it's best not to go below say 6 levels, for the reader's sake.
- Parameters:
title- Title of the outlinedest- The destination pagex- coordinate of region in Java spacey- coordinate of region in Java spacew- width of region in Java spaceh- height of region in Java space- Returns:
- PDFOutline object created, for creating sub-outlines
-
add
public void add(PDFOutline outline)
This adds an already existing outline to this one.Note: the outline must have been added to the PDF document before calling this method. Normally the other add methods are used.
- Parameters:
outline- PDFOutline to add
-
write
public void write(java.io.OutputStream os) throws java.io.IOExceptionDescription copied from class:PDFObjectWrites the object to the output stream. This method must be overidden.
Note: It should not write any other objects, even if they are it's Kids, as they will be written by the calling routine.
-
getIndex
protected int getIndex(PDFOutline outline)
This is called by children to find their position in this outlines tree.- Parameters:
outline- PDFOutline to search for- Returns:
- index within Vector
-
getLast
protected int getLast()
Returns the last index in this outline- Returns:
- last index in outline
-
getNode
protected PDFOutline getNode(int i)
Returns the outline at a specified position.- Parameters:
i- index- Returns:
- the node at index i
-
elements
public java.util.Enumeration<PDFOutline> elements()
Returns all outlines directly below this one.- Returns:
- Enumeration of child elements
-
descendants
protected int descendants()
Returns the total number of descendants below this one.- Returns:
- the number of descendants below this one
-
-