Open or close the Bookmark pane programmatically
16 Feb 20261 minute to read
The PDF Viewer exposes APIs to open and close the bookmark pane programmatically. Use openBookmarkPane() and closeBookmarkPane() to control the bookmark pane from application code.
Follow these steps to call the bookmark APIs from the application.
Step 1: Create a basic PDF Viewer sample using the getting started guide.
Step 2: Insert the following code snippet to implement opening the bookmark pane:
<button id="openBookmark">Open Bookmark Pane</button>document.getElementById('openBookmark').addEventListener('click', () => {
// Open Bookmark pane
viewer.bookmarkViewModule.openBookmarkPane();
});To close the Bookmark pane programmatically, use the following code:
<button id="closeBookmark">Close Bookmark Pane</button>document.getElementById('closeBookmark').addEventListener('click', () => {
// close Bookmark pane
viewer.bookmarkViewModule.closeBookmarkPane();
});