How can I help you?
PdfBookmark
6 Feb 20266 minutes to read
Represents a bookmark in a PDF document
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the bookmarks
let bookmarks: PdfBookmarkBase = document.bookmarks;
// Gets the bookmark at the specified index
let bookmark: PdfBookmark = bookmarks.at(0) as PdfBookmark;
// Destroy the document
document.destroy();Properties
Get color PdfColor
Gets the bookmark color.
Set color void
Sets the bookmark color.
| Parameter | Type | Description |
|---|---|---|
| value | PdfColor |
Bookmark color. |
Get count number
Gets the bookmark count (Read only).
Get destination PdfDestination
Gets the destination.
Set destination void
Sets the destination.
| Parameter | Type | Description |
|---|---|---|
| value | PdfDestination |
Destination. |
Get isExpanded boolean
Gets the boolean flag indicating whether the bookmark is expanded or not.
Set isExpanded void
Sets the boolean flag indicating whether the bookmark is expanded or not.
| Parameter | Type | Description |
|---|---|---|
| value | boolean |
Whether the bookmark is expanded or not. |
Get namedDestination PdfNamedDestination
Gets the named destination.
Set namedDestination void
Sets the named destination.
| Parameter | Type | Description |
|---|---|---|
| value | PdfNamedDestination |
Named destination. |
Get textStyle PdfTextStyle
Gets the text style.
Set textStyle void
Sets the text style.
| Parameter | Type | Description |
|---|---|---|
| value | PdfTextStyle |
Text style. |
Get title string
Gets the bookmark title.
Set title void
Sets the bookmark title.
| Parameter | Type | Description |
|---|---|---|
| value | string |
Bookmark title. |
Methods
add
Creates and adds a new outline to the PDF document.
| Parameter | Type | Description |
|---|---|---|
| title | string |
The title of the outline. |
Returns PdfBookmark
add
Adds a new outline (bookmark) with title and optional properties to the PDF document .
Returns PdfBookmark
add
Insert a new outline to the PDF document at specified index.
| Parameter | Type | Description |
|---|---|---|
| title | string |
The title of the outline. |
| index | number |
The index to insert. |
Returns PdfBookmark
add
Adds a new outline (bookmark) to the PDF document.
Returns PdfBookmark
at
Gets the PdfBookmark at the specified index.
| Parameter | Type | Description |
|---|---|---|
| index | number |
Bookmark index. |
Returns PdfBookmark
clear
Removes all the bookmark from the collection.
Returns void
contains
Gets the boolean flag indicating whether PdfBookmark is present or not.
| Parameter | Type | Description |
|---|---|---|
| outline | PdfBookmark |
Bookmark. |
Returns boolean
remove
Remove specified bookmark from the document.
| Parameter | Type | Description |
|---|---|---|
| title | string |
The title of the outline.typescript<br>// Load an existing PDF document<br>let document: PdfDocument = new PdfDocument(data, password);<br>// Access the first page of the PDF<br>let page: PdfPage = document.getPage(0);<br>// Get the bookmarks<br>let bookmarks: PdfBookmarkBase = document.bookmarks;<br>// Remove specified bookmark from the document.<br>bookmarks.remove('Introduction');<br>// Sets destination to the bookmark<br>bookmark.destination = new PdfDestination(page, {x: 10, 10});<br>// Destroy the document<br>document.destroy();<br> |
Returns void
remove
Remove the bookmark from the document at the specified index.
| Parameter | Type | Description |
|---|---|---|
| index | number |
The index.typescript<br>// Load an existing PDF document<br>let document: PdfDocument = new PdfDocument(data, password);<br>// Access the first page of the PDF<br>let page: PdfPage = document.getPage(0);<br>// Get the bookmarks<br>let bookmarks: PdfBookmarkBase = document.bookmarks;<br>// Remove the bookmark from the document at the index 1.<br>bookmarks.remove(1);<br>// Sets destination to the bookmark<br>bookmark.destination = new PdfDestination(page, {x: 10, 10});<br>// Destroy the document<br>document.destroy();<br> |
Returns void