Having trouble getting help?
Contact Support
Contact Support
Open and Close Bookmark pane programmatically
3 May 20241 minute to read
The PDF Viewer library allows you to open the Bookmark pane programmatically using the openBookmarkPane() method.
The following steps are used to open the Bookmark.
Step 1: Follow the steps provided in the link to create a simple PDF Viewer sample.
Step 2: Insert the following code snippet to implement the functionality for opening the Bookmark pane:
<button onClick={openBookmark}>Open Bookmark Pane</button>
<script>
function openBookmark() {
var viewer = document.getElementById('container').ej2_instances[0];
// Open Bookmark pane
viewer.bookmarkViewModule.openBookmarkPane();
}
</script>
Similarly, to close the Bookmark pane programmatically, employ the following code snippet:
<button onClick={closeBookmark}>Close Bookmark Pane</button>
<script>
function closeBookmark() {
var viewer = document.getElementById('container').ej2_instances[0];
// close Bookmark pane
viewer.bookmarkViewModule.closeBookmarkPane();
}
</script>