How to Add PDF Bookmarks and Outline
Including PDF outline, also known as bookmark, in your C# project can greatly enhance usability and UX design. PDF outlines function as a navigation tool, allowing users to easily access key pages within the document, similar to a Table of Contents. By incorporating PDF outlines, you can provide a more intuitive and user-friendly experience for your document.
How to Add PDF Bookmarks and Outline
- Download C# library to add PDF bookmarks and outline
- Load existing or render new PDF document
- Add single layer bookmark on PDF file to jump to key sections
- Add multiple layer bookmark for a hierarchical structure of organizing
- Retrieve and view bookmark properties

Install with NuGet
Install-Package IronPdf
Add Outlines & Bookmarks Example
In Adobe Acrobat Reader, outlines (also known as bookmarks) are displayed in the left sidebar, providing a convenient way to jump to key sections of the document.
With IronPDF, you have the capability to import existing outlines from PDF documents and perform various operations on them, such as adding, reordering, editing properties, and deleting bookmarks. This gives you full control over the organization and structure of your PDF files.
Tips
Add Single Layer of Bookmarks
Adding a bookmark in IronPDF is a straightforward process. You can use the AddBookmarkAtEnd
method, which requires specifying the bookmark name and the corresponding page index.
:path=/static-assets/pdf/content-code-examples/how-to/bookmarks-single-layer-bookmark.cs
using IronPdf;
// Checkbox and Combobox HTML
string FormHtml = @"
<html>
<body>
<h2>Editable PDF Form</h2>
Choose your favorite subject/s: <br>
<input type='checkbox' name='mathematics' value='Mathematics'>
Mathematics <br>
<input type='checkbox' name='biology' value='Biology'>
Biology <br>
<input type='checkbox' name='history' value='History'>
History <br> <br>
Choose your dream job: <br>
<select name='dreamjob'>
<option value='Researcher'>Researcher</option>
<option value='Pilot'>Pilot</option>
<option value='Doctor'>Doctor</option>
</select>
</body>
</html>
";
// Instantiate Renderer
ChromePdfRenderer Renderer = new ChromePdfRenderer();
Renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
Renderer.RenderHtmlAsPdf(FormHtml).SaveAs("checkboxAndComboboxForm.pdf");
Imports IronPdf
' Checkbox and Combobox HTML
Private FormHtml As String = "
<html>
<body>
<h2>Editable PDF Form</h2>
Choose your favorite subject/s: <br>
<input type='checkbox' name='mathematics' value='Mathematics'>
Mathematics <br>
<input type='checkbox' name='biology' value='Biology'>
Biology <br>
<input type='checkbox' name='history' value='History'>
History <br> <br>
Choose your dream job: <br>
<select name='dreamjob'>
<option value='Researcher'>Researcher</option>
<option value='Pilot'>Pilot</option>
<option value='Doctor'>Doctor</option>
</select>
</body>
</html>
"
' Instantiate Renderer
Private Renderer As New ChromePdfRenderer()
Renderer.RenderingOptions.CreatePdfFormsFromHtml = True
Renderer.RenderHtmlAsPdf(FormHtml).SaveAs("checkboxAndComboboxForm.pdf")
Single-layer Bookmarks Document
Add Multiple Layers of Bookmarks
With IronPDF, you can add bookmarks in a tree structure, which is particularly useful for maintaining navigability in large PDF documents. This feature comes in handy when dealing with extensive collections of examination papers, sales reports, or receipt records from various dates and locations in a single PDF document.
The AddBookMarkAtEnd
method returns an IPdfBookMark object, allowing you to add child bookmarks. For example, you can use Children.AddBookMarkAtStart("Date1", 0)
or Children.AddBookMarkAtEnd("Date1", 0)
to add child bookmarks to the "Examination" bookmark. The following code demonstrates this concept:
:path=/static-assets/pdf/content-code-examples/how-to/bookmarks-multi-layer-bookmark.cs
using IronPdf;
// Load existing PDF document
PdfDocument pdf = PdfDocument.FromFile("examinationPaper.pdf");
// Assign IPdfBookMark object to a variable
var mainBookmark = pdf.Bookmarks.AddBookMarkAtEnd("Examination", 0);
// Add bookmark for days
var date1Bookmark = mainBookmark.Children.AddBookMarkAtStart("Date1", 1);
// Add bookmark for type of test
var paperBookmark = date1Bookmark.Children.AddBookMarkAtStart("Paper", 1);
paperBookmark.Children.AddBookMarkAtEnd("PersonA", 3);
paperBookmark.Children.AddBookMarkAtEnd("PersonB", 4);
// Add bookmark for days
var date2Bookmark = mainBookmark.Children.AddBookMarkAtEnd("Date2", 5);
// Add bookmark for type of test
var computerBookmark = date2Bookmark.Children.AddBookMarkAtStart("Computer", 5);
computerBookmark.Children.AddBookMarkAtEnd("PersonC", 6);
computerBookmark.Children.AddBookMarkAtEnd("PersonD", 7);
pdf.SaveAs("multiLayerBookmarks.pdf");
Imports IronPdf
' Load existing PDF document
Private pdf As PdfDocument = PdfDocument.FromFile("examinationPaper.pdf")
' Assign IPdfBookMark object to a variable
Private mainBookmark = pdf.Bookmarks.AddBookMarkAtEnd("Examination", 0)
' Add bookmark for days
Private date1Bookmark = mainBookmark.Children.AddBookMarkAtStart("Date1", 1)
' Add bookmark for type of test
Private paperBookmark = date1Bookmark.Children.AddBookMarkAtStart("Paper", 1)
paperBookmark.Children.AddBookMarkAtEnd("PersonA", 3)
paperBookmark.Children.AddBookMarkAtEnd("PersonB", 4)
' Add bookmark for days
Dim date2Bookmark = mainBookmark.Children.AddBookMarkAtEnd("Date2", 5)
' Add bookmark for type of test
Dim computerBookmark = date2Bookmark.Children.AddBookMarkAtStart("Computer", 5)
computerBookmark.Children.AddBookMarkAtEnd("PersonC", 6)
computerBookmark.Children.AddBookMarkAtEnd("PersonD", 7)
pdf.SaveAs("multiLayerBookmarks.pdf")
Multi-layer Bookmarks Document
Retrieve Bookmarks List
With IronPdf, you can easily retrieve and view the bookmarks in a PDF document. Navigating through the bookmark tree is straightforward and provides seamless access to different sections. Let's consider the Multi-layer Bookmarks Document above.
The "Examination" bookmark will have a Children property that points to the "Date1" and "Date2" bookmarks. The "Date1" bookmark, in turn, has a NextBookmark property that points to the "Date2" bookmark. Additionally, the "Date1" bookmark has a Children property that contains the "Paper" bookmark.
To retrieve all the bookmarks present in the opened PDF document, you can use the GetAllBookmarks
method. This will provide you with a comprehensive list of all bookmarks, allowing you to further analyze and utilize the bookmark structure.
:path=/static-assets/pdf/content-code-examples/how-to/bookmarks-retrieve-bookmark.cs
using IronPdf;
// Load existing PDF document
PdfDocument pdf = PdfDocument.FromFile("multiLayerBookmarks.pdf");
// Retrieve bookmarks list
var mainBookmark = pdf.Bookmarks.GetAllBookmarks();
Imports IronPdf
' Load existing PDF document
Private pdf As PdfDocument = PdfDocument.FromFile("multiLayerBookmarks.pdf")
' Retrieve bookmarks list
Private mainBookmark = pdf.Bookmarks.GetAllBookmarks()