Some test text!

Search
Hamburger Icon

Web / Guides / Edit outline

Edit PDF outlines: text, color, action using JavaScript

Make sure you have Full API enabled in WebViewer.

To rename or edit an outline's color 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);
      const root = await doc.getFirstBookmark();

      // Rename outline
      root.setTitle('new outline');

      // Adding color to Outlines. Color and other formatting can help readers
      // get around more easily in large PDF documents.
      root.setColor(1, 0, 0);
    })()
  </script>
</html>

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

About editing an outline

The Outline API allows you to change any property on an outline item, including title text, action, color, and formatting. Color and other formatting can help readers navigate large PDF documents more easily. The above code renames an outline and also adjusts color and formatting properties on an Outline item.

Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales