Class Bookmark

java.lang.Object
com.datalogics.PDFL.Bookmark

public class Bookmark extends Object
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 Details

    • delete

      public void delete()
    • equals

      public boolean equals(Object rhs)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getFirstChild

      public Bookmark getFirstChild()
      Gets a bookmark's first child.

      Returns:
      The first child of Bookmark, or null if Bookmark has no children.
    • getLastChild

      public Bookmark getLastChild()
      Gets a bookmark's last child.

      Returns:
      The last child of Bookmark, or null if Bookmark has no children.
    • getParent

      public Bookmark 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

      public Bookmark 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

      public Bookmark 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

      public String getTitle()
      The title of the bookmark.

    • setTitle

      public void setTitle(String title)
      The title of the bookmark.

    • getViewDestination

      public ViewDestination getViewDestination()
      If this bookmark has a GoTo action, then return the destination of the action, else return null.

      Returns:
      the view destination
    • getColor

      public Color getColor()
      Get the color of the bookmark.

      Returns:
      the color, or null if no color was specified
    • setColor

      public void setColor(Color bookmarkcolor)
      Set the color of the bookmark.

    • getFlags

      public EnumSet<BookmarkFlags> getFlags()
      Get the flags for the bookmark.

      Returns:
      the flags
    • setFlags

      public void setFlags(EnumSet<BookmarkFlags> arg0)
      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

      public void addChild(Bookmark child)
      Add an existing bookmark to be the child bookmark of a parent.

      Parameters:
      child - the bookmark being added.
    • addNextSibling

      public void addNextSibling(Bookmark NewRightSibling)
      Add a bookmark to a tree as the next (right) sibling.
      Parameters:
      NewRightSibling - The bookmark to become the new right sibling.
    • addPreviousSibling

      public void addPreviousSibling(Bookmark NewLeftSibling)
      Add a bookmark to a tree as the previous (left) sibling.
      Parameters:
      NewLeftSibling - The bookmark to become the new left sibling.
    • createNewSibling

      public Bookmark createNewSibling(String title)
      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

      public void addSubtree(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.

      Parameters:
      subtree - The bookmark subtree to add.
      title - the title of the newly added subtree.
    • createNewChild

      @Deprecated public Bookmark createNewChild(Page page, String title)
      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

      public Bookmark createNewChild(String title)
      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

      public Action getAction()
      Get the Action for a bookmark.

      Returns:
      The action of the bookmark.
    • setAction

      public void setAction(Action action)
      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

      public PDFDict getPDFDict()
      Get the dictionary associated with the bookmark.

      Returns:
      The dictionary associated with the bookmark.
    • findDescendentBookmark

      public Bookmark 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.)

      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

      public Bookmark findDescendentBookmark(String title)
      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.