/ PDF / PdfBookmark
Search results

PdfBookmark API in JavaScript (ES5) PDF API control

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

color number[]

Gets the bookmark color.

count number

Gets the bookmark count (Read only).

destination PdfDestination

Gets the destination.

isExpanded boolean

Gets the boolean flag indicating whether the bookmark is expanded or not.

namedDestination PdfNamedDestination

Gets the named destination.

textStyle PdfTextStyle

Gets the text style.

title string

Gets the 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

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

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, [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, [10, 10]);<br>// Destroy the document<br>document.destroy();<br>

Returns void