Class PdfBookMark
Represents a single PDF bookmark (outline entry) for document navigation. Bookmarks appear in the sidebar of PDF readers, enabling quick jumps to specific pages.
Bookmarks form a hierarchical tree structure with parent-child relationships, allowing organized document navigation (e.g., chapters with sections).
Example - Create document outline:
var pdf = new ChromePdfRenderer().RenderHtmlAsPdf(htmlContent);
// Add top-level bookmarks:
var chapter1 = pdf.Bookmarks.AddBookMarkAtEnd("Chapter 1: Introduction", 0);
var chapter2 = pdf.Bookmarks.AddBookMarkAtEnd("Chapter 2: Getting Started", 5);
// Add nested bookmarks (sections):
chapter1.Children.AddBookMarkAtEnd("1.1 Overview", 0);
chapter1.Children.AddBookMarkAtEnd("1.2 Requirements", 2);
// Insert bookmark between existing ones:
chapter1.InsertBookMarkAfter("1.1a Quick Start", 1);
pdf.SaveAs("documented.pdf");
Inheritance
Namespace: IronPdf.Bookmarks
Assembly: IronPdf.dll
Syntax
public class PdfBookMark : Object, IPdfBookmark
Use PdfBookMark in IronPDF when a C# application works with PDF bookmarks. It represents a single PDF bookmark (outline entry) for document navigation.
PdfBookMark matters when an application needs to configure or invoke PDF bookmarks from C# code. The class encapsulates the related options and behavior in a single object that is set up once and reused across render or processing calls. Typical scenarios include batch generation pipelines, templated document workflows, and integration with existing C# document services.
To use PdfBookMark, instantiate or obtain it from the relevant entry point in the IronPDF C# API. Key properties include Bottom, Children, DestinationType, ItemId. Assign options or invoke methods on the instance to configure or perform the operation. The add copy delete pages PDF covers typical usage in C# end to end.
using IronPdf;
// Obtain PdfBookMark from the relevant entry point in the IronPDF API
void Configure(PdfBookMark instance)
{
var current = instance.Bottom;
instance.InsertBookMarkAfter();
}For the broader workflow, see the bookmarks guide in the IronPDF C# documentation. For broader context, the PDF bookmarks portion of the IronPDF C# API contains related types that work with PdfBookMark directly. PdfBookMark exposes additional members beyond those highlighted above; the reference tables on this page list the full set. In application code, treat PdfBookMark as a configured object that is constructed once and reused across operations rather than instantiated per call. Configuration is generally idempotent: assigning the same property value twice has the same effect as assigning it once. For diagnostic purposes, inspect the relevant PdfBookMark property after each operation to confirm the configured state. See the constructors, properties, and methods tables below for the complete API surface of PdfBookMark. Application code typically obtains or instantiates a single PdfBookMark and shares it across multiple IronPDF operations rather than recreating it per call.
Properties
Bottom
Declaration
public int Bottom { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Children
Gets the collection of child bookmarks nested under this bookmark. Use to create hierarchical navigation structures (chapters → sections → subsections).
Example:
var chapter = pdf.Bookmarks.AddBookMarkAtEnd("Chapter 1", 0);
chapter.Children.AddBookMarkAtEnd("Section 1.1", 1);
chapter.Children.AddBookMarkAtEnd("Section 1.2", 3);
Declaration
public IPdfBookMarkCollection Children { get; }
Property Value
| Type | Description |
|---|---|
| IPdfBookMarkCollection | Collection of nested bookmarks. Empty if no children exist. |
DestinationType
Gets the type of navigation destination for this bookmark. Default is Page (navigate to page).
Declaration
public virtual BookmarkDestinations DestinationType { get; }
Property Value
| Type | Description |
|---|---|
| BookmarkDestinations | The bookmark destination type. |
ItemId
Declaration
public string ItemId { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Left
Declaration
public int Left { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
NextBookmark
Gets the next sibling bookmark at the same hierarchical level.
Returns null if this is the last bookmark at this level.
Declaration
public IPdfBookmark NextBookmark { get; }
Property Value
| Type | Description |
|---|---|
| IronPdf.Bookmarks.IPdfBookmark | Next sibling bookmark, or null. |
PageIndex
Gets or sets the zero-based page index that this bookmark navigates to. Page 1 = index 0, Page 2 = index 1, etc.
Example:
// Navigate to page 5 (index 4):
bookmark.PageIndex = 4;
Declaration
public int PageIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | Zero-based page index (default: 0). |
Parent
Bookmark which contains this bookmark
Declaration
public IPdfBookmark Parent { get; }
Property Value
| Type | Description |
|---|---|
| IronPdf.Bookmarks.IPdfBookmark |
ParentText
Parent bookmark text
Declaration
public string ParentText { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
PreviousBookmark
Gets the previous sibling bookmark at the same hierarchical level.
Returns null if this is the first bookmark at this level.
Declaration
public IPdfBookmark PreviousBookmark { get; }
Property Value
| Type | Description |
|---|---|
| IronPdf.Bookmarks.IPdfBookmark | Previous sibling bookmark, or null. |
PreviousText
Previous bookmark text
Declaration
public string PreviousText { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Right
Declaration
public int Right { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Siblings
Gets the collection of sibling bookmarks at the same hierarchical level. Includes all bookmarks sharing the same parent, including this bookmark.
Declaration
public IPdfBookMarkCollection Siblings { get; }
Property Value
| Type | Description |
|---|---|
| IPdfBookMarkCollection | Collection of sibling bookmarks. |
Text
Gets or sets the display text shown in the PDF reader's bookmark panel. Use descriptive text like chapter titles, section names, or page descriptions.
Example:
bookmark.Text = "Chapter 3: Advanced Topics";
Declaration
public string Text { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The bookmark display text. |
Top
Declaration
public int Top { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Zoom
Declaration
public int Zoom { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
InsertBookMarkAfter(String, Int32)
Insert a new bookmark after the specified bookmark
Declaration
public IPdfBookmark InsertBookMarkAfter(string text, int pageIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The display text for the link. |
| System.Int32 | pageIndex | The zero based page number to link to. E.g. Page 1 has a PageIndex of 0 |
Returns
| Type | Description |
|---|---|
| IronPdf.Bookmarks.IPdfBookmark |
InsertBookMarkBefore(String, Int32)
Insert a new bookmark after the specified bookmark
Declaration
public IPdfBookmark InsertBookMarkBefore(string text, int pageIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The display text for the link. |
| System.Int32 | pageIndex | The zero based page number to link to. E.g. Page 1 has a PageIndex of 0 |
Returns
| Type | Description |
|---|---|
| IronPdf.Bookmarks.IPdfBookmark |