com.snowtide.pdf
Class Bookmark

java.lang.Object
  extended by com.snowtide.pdf.Bookmark

public class Bookmark
extends java.lang.Object

Instances of this class form a singly-rooted tree available in some PDF documents. The elements in such a tree, available via the PDFTextStream.getBookmarks() function, refer to a page within the source PDF document. In addition, some Bookmarks may also refer to a position on the referred page, further specifying the location of a section of interest within the source PDF document.

NOTE: If PDFTextStream is not fully licensed, then the title fields of approximately half of all Bookmark objects will be slightly modified.

Since:
v1.3.5
Version:
©2004-2012 Snowtide Informatics Systems, Inc.

Method Summary
 java.util.List getAllChildren()
          Returns a new List of the direct descendants of this bookmark.
 int getAllChildren(java.util.List dest)
          Adds all of the direct descendants of this bookmark to the given list.
 java.util.List getAllDescendants()
          Performs a full descent of the bookmark tree rooted at this bookmark, adding all descendant child bookmarks to a new list, which is returned.
 int getAllDescendants(java.util.List dest)
          Performs a full descent of the bookmark tree rooted at this bookmark, adding all descendant child bookmarks to the given list.
 float getBottomBound()
          Returns the y-coordinate on the page to which this bookmark refers where a PDF viewer should position the bottom edge of its window when the bookmark is activated.
 Bookmark getChild(int n)
          Returns the n-th child of this bookmark.
 int getChildCnt()
          Returns the number of children this bookmark contains.
 java.lang.String getDestinationName()
          Returns the name of the destination associated with this Bookmark.
 float getLeftBound()
          Returns the x-coordinate on the page to which this bookmark refers where a PDF viewer should position the left edge of its window when the bookmark is activated.
 int getPageNumber()
          Returns the page number for this bookmark.
 float getRightBound()
          Returns the x-coordinate on the page to which this bookmark refers where a PDF viewer should position the right edge of its window when the bookmark is activated.
 java.lang.String getTitle()
          Returns the title/label for this bookmark.
 float getTopBound()
          Returns the y-coordinate on the page to which this bookmark refers where a PDF viewer should position the top edge of its window when the bookmark is activated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTitle

public java.lang.String getTitle()
Returns the title/label for this bookmark. May be null, especially if this bookmark is the root of a PDF document's bookmark tree.


getDestinationName

public java.lang.String getDestinationName()
Returns the name of the destination associated with this Bookmark. This value may be null if this Bookmark is not associated with a named destination.


getPageNumber

public int getPageNumber()
Returns the page number for this bookmark. The page number is 0-based, and can be used to access the corresponding page object via the parent PDFTextStream instance's PDFTextStream.getPage(int) method. This function may return -1 if no page number is specified for a bookmark; this is very likely if this bookmark is the root of a PDF document's bookmark tree.


getLeftBound

public float getLeftBound()
Returns the x-coordinate on the page to which this bookmark refers where a PDF viewer should position the left edge of its window when the bookmark is activated. If unspecified, this function will return -1.


getRightBound

public float getRightBound()
Returns the x-coordinate on the page to which this bookmark refers where a PDF viewer should position the right edge of its window when the bookmark is activated. If unspecified, this function will return -1.


getTopBound

public float getTopBound()
Returns the y-coordinate on the page to which this bookmark refers where a PDF viewer should position the top edge of its window when the bookmark is activated. If unspecified, this function will return -1.


getBottomBound

public float getBottomBound()
Returns the y-coordinate on the page to which this bookmark refers where a PDF viewer should position the bottom edge of its window when the bookmark is activated. If unspecified, this function will return -1.


getChildCnt

public int getChildCnt()
Returns the number of children this bookmark contains.


getChild

public Bookmark getChild(int n)
Returns the n-th child of this bookmark.

Throws:
java.lang.IndexOutOfBoundsException - - if n is out of range (n < 0 || n >= getChildCnt()).

getAllChildren

public int getAllChildren(java.util.List dest)
Adds all of the direct descendants of this bookmark to the given list.

Returns:
the number of bookmarks added to the given list

getAllChildren

public java.util.List getAllChildren()
Returns a new List of the direct descendants of this bookmark. The returned List is guaranteed to provide fast random access.


getAllDescendants

public int getAllDescendants(java.util.List dest)
Performs a full descent of the bookmark tree rooted at this bookmark, adding all descendant child bookmarks to the given list.

Returns:
the number of bookmarks added to the given list

getAllDescendants

public java.util.List getAllDescendants()
Performs a full descent of the bookmark tree rooted at this bookmark, adding all descendant child bookmarks to a new list, which is returned. The returned List is guaranteed to provide fast random access.