Class BookmarkManager
java.lang.Object
com.ironsoftware.ironpdf.bookmark.BookmarkManager
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 Summary
ConstructorDescriptionBookmarkManager
(InternalPdfDocument internalPdfDocument) Please get BookmarkManager byPdfDocument.getBookmark()
instead. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addBookMarkAtEnd
(String text, int pageIndex) Add a new bookmark at the end of the bookmark collectionfinal void
addBookMarkAtStart
(String text, int pageIndex) Add a new bookmark at the start of the document collectionfinal Bookmark
addChildBookmark
(String text, int pageIndex, String parentBookmarkText) Add a new bookmark as a first child of this bookmark.Retrieve all bookmarks within this PDF, recursively retrieve all children of bookmarks within this collection, and return as a flat listfinal int
getCount()
Total number of bookmarks, including all nested bookmarksfinal void
insertBookmark
(Bookmark bookmark) Insert a new bookmarkfinal void
insertBookmark
(String text, int pageIndex, String parentText, String previousText) Insert a new bookmark
-
Constructor Details
-
BookmarkManager
Please get BookmarkManager byPdfDocument.getBookmark()
instead.- Parameters:
internalPdfDocument
- the internal pdf document
-
-
Method Details
-
getCount
public final int getCount()Total number of bookmarks, including all nested bookmarks- Returns:
- Bookmarks count
-
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
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
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
Insert a new bookmark- Parameters:
bookmark
- a bookmark object.
-
addChildBookmark
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
-