Class Bookmark
java.lang.Object
com.ironsoftware.ironpdf.bookmark.Bookmark
Represents a PDF bookmark as seen in the sidebar of PDF reader software to help users navigate.
Bookmarks are arranged and navigated in a parent/child node hierarchy, similar to an HTML DOM.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal Bookmark
AddChildBookmark
(String text, int pageIndex) Add a new bookmark as a first child of this bookmark.final void
addNextBookmark
(String text, int pageIndex) Add a new bookmark after this bookmarkfinal void
AddPreviousBookmark
(String text, int pageIndex) Add a new bookmark before this bookmarkfinal BookmarkManager
Gets bookmark manager.final BookmarkDestinations
Gets destination type.final String
Gets next bookmark text.final int
Gets page index.final String
Gets parent bookmark text.final String
Gets previous bookmark text.final String
getText()
Gets text.final void
Sets text.
-
Constructor Details
-
Bookmark
public Bookmark(@Nonnull String text, int pageIndex, @Nullable String parentBookmarkText, BookmarkDestinations destinationType, @Nullable String nextBookmarkText, @Nullable String previousBookmarkText) Instantiates a new Bookmark.- Parameters:
text
- the display text of the bookmarkpageIndex
- the zero based page number that the bookmark links to.parentBookmarkText
- the text of parent bookmark which contains this bookmark. Null if it is root bookmark.destinationType
- the type of destination represented by the bookmarknextBookmarkText
- the text of next bookmark at the current level, if any. Null if it is last bookmark.previousBookmarkText
- the previous bookmark at the current level, if any. Null if it is first bookmark.
-
-
Method Details
-
getDestinationType
Gets destination type. Type of destination represented by the bookmark.- Returns:
- the destination type
-
getNextBookmarkText
Gets next bookmark text. The text of next bookmark at the current level, if any. Null if it is last bookmark.- Returns:
- the next bookmark text
-
getPageIndex
public final int getPageIndex()Gets page index. The zero based page number that the bookmark links to.- Returns:
- the page index
-
getBookmarkManager
Gets bookmark manager.BookmarkManager
- Returns:
- the bookmark manager
-
addNextBookmark
Add a new bookmark after this bookmark- Parameters:
text
- the display text of the bookmarkpageIndex
- the zero based page number that the bookmark links to.
-
getParentBookmarkText
Gets parent bookmark text. The text of parent bookmark which contains this bookmark. Null if it is root bookmark.- Returns:
- the parent bookmark text
-
getText
Gets text. The display text of the bookmark.- Returns:
- the text
-
setText
Sets text. The display text of the bookmark- Parameters:
value
- the value
-
AddPreviousBookmark
Add a new bookmark before this bookmark- Parameters:
text
- the display text of the bookmarkpageIndex
- the zero based page number that the bookmark links to.
-
getPreviousBookmarkText
Gets previous bookmark text. Previous bookmark at the current level, if any. Null if it is first bookmark.- Returns:
- the previous bookmark text.
-
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 of the bookmarkpageIndex
- the zero based page number that the bookmark links to.- Returns:
- a new child bookmark
-