Some test text!

Loading...
Guides
Remove outline

Removing outlines from PDFs using JavaScript

Only available with the Full API

To remove an outline 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 outline by title text.
      const firstOutline = await doc.getFirstBookmark();
      const foo = await firstOutline.find('foo');
      if (await foo.isValid()) {
        foo.delete();
      }
    })()
  </script>
</html>

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

About removing an outline

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

Get the answers you need: Support

Upcoming Webinar: PDFTron SDK Tech Review | Nov 29, 2022 at 2 pm ET

PDFTron SDK

The Platform

NEW

© 2022 PDFTron Systems Inc. All rights reserved.

Privacy

Terms of Use