Search Results for

    Show / Hide Table of Contents

    Namespace IronPdf.Bookmarks

    Classes

    BookmarkDestinations

    Bookmark destinations

    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");

    PdfBookMarkCollection

    Manages a collection of PDF bookmarks (document outline) for navigation. Supports adding, removing, and traversing bookmarks in a hierarchical structure.

    Access the root collection via Bookmarks. Each bookmark can have its own Children collection for nested entries.

    Example - Build complete document outline:

    var pdf = PdfDocument.FromFile("manual.pdf");
    

    // Create root-level chapters: var intro = pdf.Bookmarks.AddBookMarkAtEnd("Introduction", 0); var basics = pdf.Bookmarks.AddBookMarkAtEnd("Basic Concepts", 5); var advanced = pdf.Bookmarks.AddBookMarkAtEnd("Advanced Topics", 20);

    // Add nested sections: intro.Children.AddBookMarkAtEnd("Welcome", 0); intro.Children.AddBookMarkAtEnd("Getting Started", 2);

    basics.Children.AddBookMarkAtEnd("Core Features", 5); basics.Children.AddBookMarkAtEnd("Configuration", 10);

    // List all bookmarks: foreach (var bm in pdf.Bookmarks.GetAllBookmarks()) Console.WriteLine($"{bm.Text} → Page {bm.PageIndex + 1}");

    pdf.SaveAs("manual_with_outline.pdf");

    Interfaces

    IPdfBookMarkCollection

    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget