|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.pdf2.PDFObject
org.faceless.pdf2.PDFMap
org.faceless.pdf2.PDFBookmark
This class describes the Bookmark
or Outline
part of a PDF document - the "Table of Contents" structure that allows
easy navigation through the document.
Bookmarks are structured like a directory tree, with each node on the tree having zero or more children. The top of the tree is always the document itself.
ExampleHere's an example of a simple bookmark tree, and the code that creates it.
+-- Section 1 -+-- SubSection 1.1 | | | +-- SubSection 1.2 | +-- Section 2
PDF pdf = new PDF(); // Add the top level bookmarks "Section 1" and "Section 2" to the document. List topbookmarks = pdf.getBookmarks(); PDFBookmark s1 = new PDFBookmark("Section 1", someaction); PDFBookmark s2 = new PDFBookmark("Section 2", someaction); topbookmarks.add(s1); topbookmarks.add(s2); // Add the bookmarks under "Section 1" List s1bookmarks = s1.getBookmarks(); PDFBookmark s11 = new PDFBookmark("SubSection 1.1", someaction); PDFBookmark s12 = new PDFBookmark("SubSection 1.2", someaction); s1bookmarks.add(s11); s1bookmarks.add(s12);
There is no limit to the number of bookmarks in a PDF document or to the
level they are nested. To display the bookmarks when the document is first
opened, see the PDF.setLayout(java.lang.String, java.lang.String)
method.
Constructor Summary | |
PDFBookmark(String name,
PDFAction action)
Create a new bookmark with an initial state of "closed". |
|
PDFBookmark(String name,
PDFAction action,
boolean open)
Create a new bookmark and set the initial state to "open" or "closed" |
Method Summary | |
boolean |
equals(Object o)
|
PDFAction |
getAction()
Get the action this bookmark performs when selected |
List |
getBookmarks()
Return the a List containing this bookmarks children. |
String |
getName()
Get the name of this bookmark |
void |
setAction(PDFAction action)
Set the action this bookmark performs when selected |
void |
setColor(Color c)
Set the color of the Bookmark. |
void |
setName(String name)
Set the name of this bookmark |
void |
setStyle(boolean italic,
boolean bold)
Set the style of the Bookmark to italic, bold or both. |
String |
toString()
|
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public PDFBookmark(String name, PDFAction action)
name
- The name of the bookmark as seen by the user. May include
Unicode characters.action
- the action to perform when the bookmark is selectedpublic PDFBookmark(String name, PDFAction action, boolean open)
name
- The name of the bookmark as seen by the user. May include
Unicode characters.action
- The action to perform when the bookmark is selectedopen
- Whether the bookmark is open by defaultMethod Detail |
public List getBookmarks()
PDFBookmark
,
and may be altered using any of the standard List
methods.
public void setColor(Color c)
public void setStyle(boolean italic, boolean bold)
public void setAction(PDFAction action)
action
- the action to perform when the bookmark is activated - may be nullpublic PDFAction getAction()
public void setName(String name)
name
- The name of the bookmark as seen by the user. May include
Unicode characters.public String getName()
public String toString()
public boolean equals(Object o)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |