IBookmarkCollection Interface
A collection of PDF document bookmarks.
Declaration
public interface IBookmarkCollection extends IObjectCollectionBase<Bookmark>
Remarks
Refer to the following help topic for additional information: Create and Manage PDF Bookmarks.
The following code snippet creates nested bookmarks. The document outline displays a collapsible bookmark tree.
Bookmark chapters = new Bookmark("Chapters");
// Create child bookmarks.
Bookmark chapter1 = new Bookmark("Chapter 1");
chapter1.setPage(document.getPages().get(1));
chapter1.setDestination(new FitDestination());
Bookmark chapter2 = new Bookmark("Chapter 2");
chapter2.setPage(document.getPages().get(2));
chapter2.setDestination(new FitDestination());
// Add child bookmarks.
chapters.getChildren().add(chapter1);
chapters.getChildren().add(chapter2);
document.getBookmarks().add(chapters);
Implements
Methods
add(String title, Page page, Destination destination) Method
Adds a bookmark with the specified title, page, and destination settings.
Declaration
public abstract Bookmark add(String title, Page page, Destination destination)
Parameters
| Name | Type | Description |
|---|---|---|
| title | String | The bookmark title. |
| page | Page | The destination page. |
| destination | Destination | The destination view on the page. |
Returns
| Type | Description |
|---|---|
| Bookmark | The added bookmark. |
add(String title, Page page) Method
Adds a bookmark with the specified title and destination page.
Declaration
public abstract Bookmark add(String title, Page page)
Parameters
| Name | Type | Description |
|---|---|---|
| title | String | The bookmark title. |
| page | Page | The destination page. |
Returns
| Type | Description |
|---|---|
| Bookmark | The added bookmark. |
find(Predicate<Bookmark> predicate, Bookmark[] parent, Runnable parent_sync) Method
Searches for a bookmark that matches the specified condition and returns its parent bookmark.
Declaration
public abstract Bookmark find(Predicate<Bookmark> predicate, Bookmark[] parent, Runnable parent_sync)
Parameters
| Name | Type | Description |
|---|---|---|
| predicate | java.util.function.Predicate<Bookmark> | The search condition. |
| parent | Bookmark[] | The array that receives the parent bookmark context. |
| parent_sync | Runnable | The action that syncs the parent bookmark context. |
Returns
| Type | Description |
|---|---|
| Bookmark | The first matching bookmark; otherwise, |
find(Predicate<Bookmark> predicate) Method
Searches for a bookmark that matches the specified predicate.
Declaration
public abstract Bookmark find(Predicate<Bookmark> predicate)
Parameters
| Name | Type | Description |
|---|---|---|
| predicate | java.util.function.Predicate<Bookmark> | The search condition. |
Returns
| Type | Description |
|---|---|
| Bookmark | The first matching bookmark; otherwise, |
findAll(Predicate<Bookmark> predicate) Method
Searches for all bookmarks that match the specified condition.
Declaration
public abstract List<Bookmark> findAll(Predicate<Bookmark> predicate)
Parameters
| Name | Type | Description |
|---|---|---|
| predicate | java.util.function.Predicate<Bookmark> | The search condition. |
Returns
| Type | Description |
|---|---|
| java.util.List<Bookmark> | A list of matching bookmarks. |
findByTitle(String title, Bookmark[] parent, Runnable parent_sync) Method
Searches for a bookmark with the specified title and returns its parent bookmark.
Declaration
public abstract Bookmark findByTitle(String title, Bookmark[] parent, Runnable parent_sync)
Parameters
| Name | Type | Description |
|---|---|---|
| title | String | The bookmark title. |
| parent | Bookmark[] | The array that receives the parent bookmark context. |
| parent_sync | Runnable | The action that syncs the parent bookmark context. |
Returns
| Type | Description |
|---|---|
| Bookmark | The first matching bookmark; otherwise, |
findByTitle(String title) Method
Searches for a bookmark with the specified title and returns its parent bookmark.
Declaration
public abstract Bookmark findByTitle(String title)
Parameters
| Name | Type | Description |
|---|---|---|
| title | String | The bookmark title to match. |
Returns
| Type | Description |
|---|---|
| Bookmark | The first matching bookmark; otherwise, |
toFlatIterable() Method
Returns a flat sequence of all bookmarks in the collection, including child bookmarks.
Declaration
public abstract Iterable<Bookmark> toFlatIterable()
Returns
| Type | Description |
|---|---|
| java.lang.Iterable<Bookmark> | An iterable sequence of all bookmarks. |