Class BookmarkManager
- java.lang.Object
-
- com.ironsoftware.ironpdf.bookmark.BookmarkManager
-
public class BookmarkManager extends Object
Class used to add , edit and remove bookmarks from aPdfDocument
outline.Bookmarks are arranged and navigated in a parent/child node hierarchy, similar to an HTML DOM.
See:
PdfDocument.getBookmark()
See:
Bookmark
-
-
Constructor Summary
Constructors Constructor Description BookmarkManager(InternalPdfDocument internalPdfDocument)
Please get BookmarkManager byPdfDocument.getBookmark()
instead.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBookMarkAtEnd(String text, int pageIndex)
Add a new bookmark at the end of the bookmark collectionvoid
addBookMarkAtStart(String text, int pageIndex)
Add a new bookmark at the start of the document collectionBookmark
addChildBookmark(String text, int pageIndex, String parentBookmarkText)
Add a new bookmark as a first child of this bookmark.List<Bookmark>
getBookmarks()
Retrieve all bookmarks within this PDF, recursively retrieve all children of bookmarks within this collection, and return as a flat listint
getCount()
Total number of bookmarks, including all nested bookmarksvoid
insertBookmark(Bookmark bookmark)
Insert a new bookmarkvoid
insertBookmark(String text, int pageIndex, String parentText, String previousText)
Insert a new bookmark
-
-
-
Constructor Detail
-
BookmarkManager
public BookmarkManager(InternalPdfDocument internalPdfDocument)
Please get BookmarkManager byPdfDocument.getBookmark()
instead.- Parameters:
internalPdfDocument
- the internal pdf document
-
-
Method Detail
-
getCount
public final int getCount()
Total number of bookmarks, including all nested bookmarks- Returns:
- Bookmarks count
-
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 0parentText
- parent bookmark text. set to null for insert at the toppreviousText
- 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 0parentBookmarkText
- bookmark parent text, set empty if bookmark does not have parent.- Returns:
- a new child bookmark
-
-