Some test text!

Outline tree

Outline tree in documents

To navigate an outline tree and print its result.

WebViewer({ ... }, viewerElement).then(instance => {
    const { documentViewer } = instance.Core;
    documentViewer.addEventListener('documentLoaded', () => {

        const doc = documentViewer.getDocument();
        doc.getBookmarks().then((bookmarks) => {

            const printOutlineTree = (item, level) => {
                const indent = '   '.repeat(level);
                const name = item.getName();
                console.log(indent + name);
                item.getChildren().map(b => printOutlineTree(b, level+1));

   => {
                printOutlineTree(root, 0);

About outline tree

A document may contain a document outline, allowing the user to navigate interactively from one part of the document to another. The outline consists of a tree-structured hierarchy of Bookmarks (sometimes called outline items), which serve as a "visual table of contents" to display the document's structure to the user.

Each Bookmark has a title, a Page, and a scroll offset that specifies where a bookmark will take a user that clicks on the Bookmark. The typical action for a Bookmark is to move to another location in the current document — although there is an optional parameter to link to a URL instead.

Get the answers you need: Support

Upcoming Webinar: Live tech update & run-through: Redaction | March 31st at 11 am PT


The Platform


© 2022 PDFTron Systems Inc. All rights reserved.


Terms of Use