> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/web/outlines-bookmarks/edit.md).

# Edit PDF outlines: text, color, action using JavaScript

Elevate your PDF editing game with this comprehensive guide on how to read, add, and edit PDF outlines. Learn how to manipulate outline properties like title text, color, and formatting for seamless n

{% hint style="info" %}
**Requirements**

*These packages are required to use these features in production. Trial keys have unlimited access to all features*

<a href="https://apryse.com/capabilities#PageManipulation" class="button primary">Package: Page Manipulation</a><a href="https://showcase.apryse.com/edit-table-of-contents-in-a-pdf" class="button primary">Live demo</a>
{% endhint %}

{% hint style="warning" %}
Make sure you have [Full API enabled in WebViewer.](/web/what-is-webviewer/full-api.md)
{% endhint %}

To rename or edit an outline's color in an existing document.

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
<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>
```

{% endcode %}
{% endtab %}
{% endtabs %}

[PDFNet.PDFDoc.createFromURL](https://sdk.apryse.com/api/web/Core.PDFNet.PDFDoc.html#.createFromURL__anchor) [PDFNet.PDFDoc.getFirstBookmark](https://sdk.apryse.com/api/web/Core.PDFNet.PDFDoc.html#getFirstBookmark__anchor) [PDFNet.Bookmark.setColor](https://sdk.apryse.com/api/web/Core.PDFNet.Bookmark.html#setColor__anchor) [CoreControls.setWorkerPath](https://sdk.apryse.com/api/web/Core.html#.setWorkerPath__anchor)

[Read, add, edit PDF outlines](/web/get-started/samples.md#bookmarks) 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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.apryse.com/web/outlines-bookmarks/edit.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
