Some test text!

menu
Remove bookmarkkeyboard_arrow_down

Removing bookmarks from PDFs using JavaScript

Only available with the Full API

To remove a bookmark by title in an existing document.

<html>
  <script src="../lib/core/CoreControls.js"></script>
  <script src="../lib/core/pdf/PDFNet.js"></script>
  <script>
    (async function() {
      CoreControls.setWorkerPath('../lib/core');
      const doc = await PDFNet.PDFDoc.createFromURL(filename);

      // how to find and delete a bookmark by title text.
      const firstbookmark = await doc.getFirstBookmark();
      const foo = await firstbookmark.find('foo');
      if (await foo.isValid()) {
        foo.delete();
      }
    })()
  </script>
</html>

Read, add, edit PDF outlines and bookmarks
Full code sample which illustrates how to read and edit existing outline items and create new bookmarks using the high-level API

linkAbout removing a bookmark

The Bookmarks class also allows you to quickly find Bookmarks based on the title text. For example, the above code snippet looks for a Bookmark called foo and then removes it from the outline tree.

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

Join our live demo to learn about use cases & capabilities for WebViewer

Learn more
close