Package com.datalogics.PDFL
Class Bookmark
java.lang.Object
com.datalogics.PDFL.Bookmark
A bookmark on a page of a PDF document. Each bookmark has a title that appears on screen, and an action that specifies what happens when a user clicks on the bookmark.
The typical action for a user-created bookmark is to move to another location in the current document, although any action (see Action) can be specified.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an existing bookmark to be the child bookmark of a parent.voidaddNextSibling(Bookmark NewRightSibling) Add a bookmark to a tree as the next (right) sibling.voidaddPreviousSibling(Bookmark NewLeftSibling) Add a bookmark to a tree as the previous (left) sibling.voidaddSubtree(Bookmark subtree, String title) Add a copy of a subtree as the new last child of a parent bookmark, and gives the subtree an initial title.createNewChild(Page page, String title) Deprecated.createNewChild(String title) Create a new bookmark and add to a parent as the last child bookmark, using supplied string as the initial text.createNewSibling(String title) Create a new bookmark in a tree as the next (right) sibling, using supplied string as the initial text.voiddelete()voiddestroy()Removes a bookmark subtree from the bookmark tree containing it.booleanfindDescendentBookmark(String title) Find bookmark by its title within the subtree of which this bookmark is the root, searching within the entire subtree.findDescendentBookmark(String title, int maxDepth) Find bookmark by its title within the subtree of which this bookmark is the root, searching within the subtree to a depth determined by maxDepth (e.g., 0 = this bookmark only and not any of its children, 1 = search one level below this bookmark level, etc.)Get the Action for a bookmark.getColor()Get the color of the bookmark.intgetCount()Get the number of open bookmarks in the subtree under this bookmark.Gets a bookmark's first child.getFlags()Get the flags for the bookmark.intGet the indentation level of a bookmark in its containing tree.Gets a bookmark's last child.getNext()Gets a bookmark's next (right) sibling.booleangetOpen()Is the bookmark open?Gets a bookmark's parent.Get the dictionary associated with the bookmark.Gets a bookmark's previous (left) sibling.getTitle()The title of the bookmark.If this bookmark has a GoTo action, then return the destination of the action, else return null.booleanDoes the bookmark have children?booleanisOpen()Is the bookmark open?voidSet the Action for a bookmark.voidSet the color of the bookmark.voidsetFlags(EnumSet<BookmarkFlags> arg0) Set the flags for the bookmark to the parameter values.voidsetOpen(boolean openvalue) Set if the bookmark is open or closed.voidThe title of the bookmark.toString()voidunlink()Unlinks the bookmark from the bookmark tree that contains it and adjusts the tree appropriately.
-
Method Details
-
delete
public void delete() -
equals
-
toString
-
getFirstChild
Gets a bookmark's first child.- Returns:
- The first child of Bookmark, or null if Bookmark has no children.
-
getLastChild
Gets a bookmark's last child.- Returns:
- The last child of Bookmark, or null if Bookmark has no children.
-
getParent
Gets a bookmark's parent.- Returns:
- The Bookmark object's parent. It returns null if Bookmark has no parent (that is, it is the root of the tree).
-
getNext
Gets a bookmark's next (right) sibling.- Returns:
- The Bookmark object's next (right) sibling. It returns null if Bookmark has no next sibling (that is, it is its parent's last child).
-
getPrevious
Gets a bookmark's previous (left) sibling.- Returns:
- The Bookmark object's previous (left) sibling. It returns null if Bookmark has no previous sibling (that is, it is its parent's first child).
-
getTitle
The title of the bookmark. -
setTitle
The title of the bookmark. -
getViewDestination
If this bookmark has a GoTo action, then return the destination of the action, else return null.- Returns:
- the view destination
-
getColor
Get the color of the bookmark.- Returns:
- the color, or null if no color was specified
-
setColor
Set the color of the bookmark. -
getFlags
Get the flags for the bookmark.- Returns:
- the flags
-
setFlags
Set the flags for the bookmark to the parameter values. -
getCount
public int getCount()Get the number of open bookmarks in the subtree under this bookmark.- Returns:
- the number of open bookmarks.
-
getIndent
public int getIndent()Get the indentation level of a bookmark in its containing tree.- Returns:
- the indentation level of the bookmark.
-
hasChildren
public boolean hasChildren()Does the bookmark have children?- Returns:
- true if the bookmark has children.
-
isOpen
public boolean isOpen()Is the bookmark open?- Returns:
- true if the bookmark is open.
-
getOpen
public boolean getOpen()Is the bookmark open?- Returns:
- true if the bookmark is open.
-
setOpen
public void setOpen(boolean openvalue) Set if the bookmark is open or closed. -
addChild
Add an existing bookmark to be the child bookmark of a parent.- Parameters:
child- the bookmark being added.
-
addNextSibling
Add a bookmark to a tree as the next (right) sibling.- Parameters:
NewRightSibling- The bookmark to become the new right sibling.
-
addPreviousSibling
Add a bookmark to a tree as the previous (left) sibling.- Parameters:
NewLeftSibling- The bookmark to become the new left sibling.
-
createNewSibling
Create a new bookmark in a tree as the next (right) sibling, using supplied string as the initial text.- Parameters:
title- The initial text for the new right sibling.- Returns:
- The newly created sibling bookmark.
-
addSubtree
Add a copy of a subtree as the new last child of a parent bookmark, and gives the subtree an initial title.- Parameters:
subtree- The bookmark subtree to add.title- the title of the newly added subtree.
-
createNewChild
Deprecated.(Deprecated, function may be removed in the future, use single-parameter CreateNewChild() method instead) Create a bookmark and add to a parent as the last child bookmark, and give the new bookmark an initial title.- Parameters:
page- The PDF page of the new child bookmark.title- The initial title of the new child bookmark.- Returns:
- The newly created child bookmark.
-
createNewChild
Create a new bookmark and add to a parent as the last child bookmark, using supplied string as the initial text.- Parameters:
title- The initial text of the new child bookmark.- Returns:
- The newly created child bookmark.
-
getAction
Get the Action for a bookmark.- Returns:
- The action of the bookmark.
-
setAction
Set the Action for a bookmark.- Parameters:
action- The action to set for the bookmark.
-
unlink
public void unlink()Unlinks the bookmark from the bookmark tree that contains it and adjusts the tree appropriately. -
destroy
public void destroy()Removes a bookmark subtree from the bookmark tree containing it. -
getPDFDict
Get the dictionary associated with the bookmark.- Returns:
- The dictionary associated with the bookmark.
-
findDescendentBookmark
Find bookmark by its title within the subtree of which this bookmark is the root, searching within the subtree to a depth determined by maxDepth (e.g., 0 = this bookmark only and not any of its children, 1 = search one level below this bookmark level, etc.)- Parameters:
title- The title of the bookmark for which to search.maxDepth- If supplied, declares the number of levels below this bookmark to search. (If omitted, the entire subtree is searched.)- Returns:
- The bookmark within this bookmark's tree that has the supplied title. Returns NULL if there is no bookmark with the supplied title.
-
findDescendentBookmark
Find bookmark by its title within the subtree of which this bookmark is the root, searching within the entire subtree.- Parameters:
title- The title of the bookmark for which to search.- Returns:
- The bookmark within this bookmark's tree that has the supplied title. Returns NULL if there is no bookmark with the supplied title.
-