Class BookmarkManager

java.lang.Object
com.ironsoftware.ironpdf.bookmark.BookmarkManager

public class BookmarkManager extends Object
Class used to add , edit and remove bookmarks from a PdfDocument outline.

Bookmarks are arranged and navigated in a parent/child node hierarchy, similar to an HTML DOM.

See: PdfDocument.getBookmark()

See: Bookmark

  • Constructor Details

  • Method Details

    • getCount

      public final int getCount()
      Total number of bookmarks, including all nested bookmarks
    • getBookmarks

      public final List<Bookmark> getBookmarks()
      Retrieve all bookmarks within this PDF, recursively retrieve all children of bookmarks within this collection, and return as a flat list
      Returns:
      A flattened list of all bookmark ojects in this collection and all of their children
    • addBookMarkAtEnd

      public final void addBookMarkAtEnd(String text, int pageIndex)
      Add a new bookmark at the end of the bookmark collection
      Parameters:
      text - The display text for the link.
      pageIndex - The zero based page number to link to. E.g. Page 1 has a PageIndex of 0
    • addBookMarkAtStart

      public final void addBookMarkAtStart(String text, int pageIndex)
      Add a new bookmark at the start of the document collection
      Parameters:
      text - The display text for the link.
      pageIndex - The zero based page number to link to. E.g. Page 1 has a PageIndex of 0
    • insertBookmark

      public final void insertBookmark(String text, int pageIndex, String parentText, String previousText)
      Insert a new bookmark
      Parameters:
      text - The display text for the link.
      pageIndex - The zero based page number to link to. E.g. Page 1 has a PageIndex of 0
      parentText - parent bookmark text. set to null for insert at the top
      previousText - previous bookmark text. set to null for insert at first of its siblings
    • insertBookmark

      public final void insertBookmark(Bookmark bookmark)
      Insert a new bookmark
      Parameters:
      bookmark - a bookmark object.
    • addChildBookmark

      public final Bookmark addChildBookmark(String text, int pageIndex, String parentBookmarkText)
      Add a new bookmark as a first child of this bookmark. To add a bookmark as a second child, please navigate to the childBookmark object and call AddNextBookmark.
      Parameters:
      text - The display text for the link.
      pageIndex - The zero based page number to link to. E.g. Page 1 has a PageIndex of 0
      Returns:
      a new child bookmark