# Bookmark Class

> A bookmark on a page of a PDF document.

- Product: Adobe PDF Library 18
- Language: Java
- Version: APDFL18.0.5PlusP2e
- HTML page: https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark
- Version index: https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/llms.txt

```java
class Bookmark
```

**Namespace:** `com::datalogics::PDFL`

## Description

A bookmark on a page of a PDF document. Each bookmark has a title that appears on screen, and an action that specifies what happens when a user clicks on the bookmark.

The typical action for a user-created bookmark is to move to another location in the current document, although any action (see Action) can be specified.

**Referenced by:** [`Bookmark`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark.md), [`Document`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Document.md)

**Uses types:** [`Action`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Action.md), [`Bookmark`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark.md), [`Color`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Color.md), [`PDFDict`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/PDFDict.md), [`Page`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Page.md), [`ViewDestination`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/ViewDestination.md)

## Methods

### addChild

```java
void com.datalogics.PDFL.Bookmark.addChild(Bookmark child)
```

**Parameters**

- `child` ([`Bookmark`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark.md)): the bookmark being added.

**Returns:** `void`

Add an existing bookmark to be the child bookmark of a parent.

### addNextSibling

```java
void com.datalogics.PDFL.Bookmark.addNextSibling(Bookmark NewRightSibling)
```

**Parameters**

- `NewRightSibling` ([`Bookmark`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark.md)): The bookmark to become the new right sibling.

**Returns:** `void`

Add a bookmark to a tree as the next (right) sibling.

### addPreviousSibling

```java
void com.datalogics.PDFL.Bookmark.addPreviousSibling(Bookmark NewLeftSibling)
```

**Parameters**

- `NewLeftSibling` ([`Bookmark`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark.md)): The bookmark to become the new left sibling.

**Returns:** `void`

Add a bookmark to a tree as the previous (left) sibling.

### addSubtree

```java
void com.datalogics.PDFL.Bookmark.addSubtree(Bookmark subtree, String title)
```

**Parameters**

- `subtree` ([`Bookmark`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark.md)): The bookmark subtree to add.
- `title` (`String`): the title of the newly added subtree.

**Returns:** `void`

Add a copy of a subtree as the new last child of a parent bookmark, and gives the subtree an initial title.

### createNewChild

```java
Bookmark com.datalogics.PDFL.Bookmark.createNewChild(Page page, String title)
```

**Parameters**

- `page` ([`Page`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Page.md)): The PDF page of the new child bookmark.
- `title` (`String`): The initial title of the new child bookmark.

**Returns:** [`Bookmark`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark.md)

The newly created child bookmark.

(Deprecated, function may be removed in the future, use single-parameter CreateNewChild() method instead) Create a bookmark and add to a parent as the last child bookmark, and give the new bookmark an initial title.

### createNewChild

```java
Bookmark com.datalogics.PDFL.Bookmark.createNewChild(String title)
```

**Parameters**

- `title` (`String`): The initial text of the new child bookmark.

**Returns:** [`Bookmark`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark.md)

The newly created child bookmark.

Create a new bookmark and add to a parent as the last child bookmark, using supplied string as the initial text.

### createNewSibling

```java
Bookmark com.datalogics.PDFL.Bookmark.createNewSibling(String title)
```

**Parameters**

- `title` (`String`): The initial text for the new right sibling.

**Returns:** [`Bookmark`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark.md)

The newly created sibling bookmark.

Create a new bookmark in a tree as the next (right) sibling, using supplied string as the initial text.

### delete

```java
synchronized void com.datalogics.PDFL.Bookmark.delete(Boolean disposing)
```

*protected*

**Parameters**

- `disposing` (`Boolean`)

**Returns:** `synchronized void`

### delete

```java
synchronized void com.datalogics.PDFL.Bookmark.delete()
```

**Returns:** `synchronized void`

### destroy

```java
void com.datalogics.PDFL.Bookmark.destroy()
```

**Returns:** `void`

Removes a bookmark subtree from the bookmark tree containing it.

### equals

```java
boolean com.datalogics.PDFL.Bookmark.equals(Object rhs)
```

**Parameters**

- `rhs` (`Object`)

**Returns:** `boolean`

### finalize

```java
void com.datalogics.PDFL.Bookmark.finalize()
```

*protected*

**Returns:** `void`

### findDescendentBookmark

```java
Bookmark com.datalogics.PDFL.Bookmark.findDescendentBookmark(String title)
```

**Parameters**

- `title` (`String`): The title of the bookmark for which to search.

**Returns:** [`Bookmark`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark.md)

The bookmark within this bookmark's tree that has the supplied title. Returns NULL if there is no bookmark with the supplied title.

Find bookmark by its title within the subtree of which this bookmark is the root, searching within the entire subtree.

### findDescendentBookmark

```java
Bookmark com.datalogics.PDFL.Bookmark.findDescendentBookmark(String title, int maxDepth)
```

**Parameters**

- `title` (`String`): The title of the bookmark for which to search.
- `maxDepth` (`int`): If supplied, declares the number of levels below this bookmark to search. (If omitted, the entire subtree is searched.)

**Returns:** [`Bookmark`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark.md)

The bookmark within this bookmark's tree that has the supplied title. Returns NULL if there is no bookmark with the supplied title.

Find bookmark by its title within the subtree of which this bookmark is the root, searching within the subtree to a depth determined by maxDepth (e.g., 0 = this bookmark only and not any of its children, 1 = search one level below this bookmark level, etc.)

### getAction

```java
Action com.datalogics.PDFL.Bookmark.getAction()
```

**Returns:** [`Action`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Action.md)

The action of the bookmark.

Get the Action for a bookmark.

### getColor

```java
Color com.datalogics.PDFL.Bookmark.getColor()
```

**Returns:** [`Color`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Color.md)

the color, or null if no color was specified

Get the color of the bookmark.

### getCount

```java
int com.datalogics.PDFL.Bookmark.getCount()
```

**Returns:** `int`

the number of open bookmarks.

Get the number of open bookmarks in the subtree under this bookmark.

### getFirstChild

```java
Bookmark com.datalogics.PDFL.Bookmark.getFirstChild()
```

**Returns:** [`Bookmark`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark.md)

The first child of Bookmark, or null if Bookmark has no children.

Gets a bookmark's first child.

### getFlags

```java
java.util.EnumSet< BookmarkFlags > com.datalogics.PDFL.Bookmark.getFlags()
```

**Returns:** `java.util.EnumSet< BookmarkFlags >`

the flags

Get the flags for the bookmark.

### getIndent

```java
int com.datalogics.PDFL.Bookmark.getIndent()
```

**Returns:** `int`

the indentation level of the bookmark.

Get the indentation level of a bookmark in its containing tree.

### getLastChild

```java
Bookmark com.datalogics.PDFL.Bookmark.getLastChild()
```

**Returns:** [`Bookmark`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark.md)

The last child of Bookmark, or null if Bookmark has no children.

Gets a bookmark's last child.

### getNext

```java
Bookmark com.datalogics.PDFL.Bookmark.getNext()
```

**Returns:** [`Bookmark`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark.md)

The Bookmark object's next (right) sibling. It returns null if Bookmark has no next sibling (that is, it is its parent's last child).

Gets a bookmark's next (right) sibling.

### getOpen

```java
boolean com.datalogics.PDFL.Bookmark.getOpen()
```

**Returns:** `boolean`

true if the bookmark is open.

Is the bookmark open?

### getPDFDict

```java
PDFDict com.datalogics.PDFL.Bookmark.getPDFDict()
```

**Returns:** [`PDFDict`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/PDFDict.md)

The dictionary associated with the bookmark.

Get the dictionary associated with the bookmark.

### getParent

```java
Bookmark com.datalogics.PDFL.Bookmark.getParent()
```

**Returns:** [`Bookmark`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark.md)

The Bookmark object's parent. It returns null if Bookmark has no parent (that is, it is the root of the tree).

Gets a bookmark's parent.

### getPrevious

```java
Bookmark com.datalogics.PDFL.Bookmark.getPrevious()
```

**Returns:** [`Bookmark`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Bookmark.md)

The Bookmark object's previous (left) sibling. It returns null if Bookmark has no previous sibling (that is, it is its parent's first child).

Gets a bookmark's previous (left) sibling.

### getTitle

```java
String com.datalogics.PDFL.Bookmark.getTitle()
```

**Returns:** `String`

The title of the bookmark.

### getViewDestination

```java
ViewDestination com.datalogics.PDFL.Bookmark.getViewDestination()
```

**Returns:** [`ViewDestination`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/ViewDestination.md)

the view destination

If this bookmark has a GoTo action, then return the destination of the action, else return null.

### hasChildren

```java
boolean com.datalogics.PDFL.Bookmark.hasChildren()
```

**Returns:** `boolean`

true if the bookmark has children.

Does the bookmark have children?

### isOpen

```java
boolean com.datalogics.PDFL.Bookmark.isOpen()
```

**Returns:** `boolean`

true if the bookmark is open.

Is the bookmark open?

### setAction

```java
void com.datalogics.PDFL.Bookmark.setAction(Action action)
```

**Parameters**

- `action` ([`Action`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Action.md)): The action to set for the bookmark.

**Returns:** `void`

Set the Action for a bookmark.

### setColor

```java
void com.datalogics.PDFL.Bookmark.setColor(Color bookmarkcolor)
```

**Parameters**

- `bookmarkcolor` ([`Color`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Color.md))

**Returns:** `void`

Set the color of the bookmark.

### setFlags

```java
void com.datalogics.PDFL.Bookmark.setFlags(java.util.EnumSet< BookmarkFlags > arg0)
```

**Parameters**

- `arg0` (`java.util.EnumSet< BookmarkFlags >`)

**Returns:** `void`

Set the flags for the bookmark to the parameter values.

### setOpen

```java
void com.datalogics.PDFL.Bookmark.setOpen(boolean openvalue)
```

**Parameters**

- `openvalue` (`boolean`)

**Returns:** `void`

Set if the bookmark is open or closed.

### setTitle

```java
void com.datalogics.PDFL.Bookmark.setTitle(String title)
```

**Parameters**

- `title` (`String`)

**Returns:** `void`

The title of the bookmark.

### toString

```java
String com.datalogics.PDFL.Bookmark.toString()
```

**Returns:** `String`

A string describing this Bookmark and its properties.

Returns a string representation of this Bookmark. The string includes the title, color, flags, count, indent level, open state, and view destination if available.

### unlink

```java
void com.datalogics.PDFL.Bookmark.unlink()
```

**Returns:** `void`

Unlinks the bookmark from the bookmark tree that contains it and adjusts the tree appropriately.
