IRONSOFTWAREHOME
Outlines & Bookmarks
from ironpdf import *

# Create a new PDF or edit an existing document.
pdf = PdfDocument.FromFile("existing.pdf")

# Add bookmark
pdf.Bookmarks.AddBookMarkAtEnd("Author's Note", 2)
pdf.Bookmarks.AddBookMarkAtEnd("Table of Contents", 3)

# Store new bookmark in a variable to add nested bookmarks to
summaryBookmark = pdf.Bookmarks.AddBookMarkAtEnd("Summary", 17)

# Add a sub-bookmark within the summary
conclusionBookmark = summaryBookmark.Children.AddBookMarkAtStart("Conclusion", 18)

# Add another bookmark to end of highest-level bookmark list
pdf.Bookmarks.AddBookMarkAtEnd("References", 20)

pdf.SaveAs("existing.pdf")
pip install ironpdf
Outlines & Bookmarks

Outlines & Bookmarks

IronPDF for Python can add a navigable bookmark outline to PDF documents, creating a table of contents panel that readers can use to jump directly to any section - including nested sub-sections.

Getting Started

Load or create a PdfDocument, then use the pdf.Bookmarks collection to add bookmark entries. Call AddBookMarkAtEnd to append entries to the bookmark list, or AddBookMarkAtStart on a child collection to nest sub-bookmarks beneath a parent.

Understanding the Code

  • pdf.Bookmarks.AddBookMarkAtEnd(title, pageIndex): Appends a new bookmark to the end of the top-level bookmark list. pageIndex is the zero-based page index the bookmark links to. Returns the new bookmark object.
  • bookmark.Children.AddBookMarkAtStart(title, pageIndex): Adds a child bookmark under an existing bookmark, creating a nested hierarchy. Returns the child bookmark object.
  • pdf.Bookmarks.AddBookMarkAtEnd("References", 20): Appends another bookmark after all existing entries.
  • SaveAs(path): Saves the document with all bookmarks embedded in the PDF outline.

Bookmark Hierarchy

PDF bookmarks support multiple nesting levels. Each bookmark returned by AddBookMarkAtEnd or AddBookMarkAtStart has its own .Children collection, allowing you to build trees of arbitrary depth.

Page Indexing

Bookmark page indexes are zero-based. Page 1 of the document is index 0, page 18 is index 17, and so on.

Ready to Get Started?

Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required
Python Module Download for PDF
Install with pip

Version: 2026.9

  1. Download and install Python 3.7+.
  2. Install pip from pypi.org if it isn't installed already.
  3. Execute the above command in the terminal.
Python PDF Module
Download Module

Version: 2026.9

Manually install into your project

  1. Download the package
  2. Run this command from the terminal
    pip install ironpdf-2026.9-py37-none-win_amd64.whi

Licenses from $999