Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PdfDocument.Bookmarks Property

Gets or sets the bookmarks that are used to navigate from one part of a document to another.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v24.2.Core.dll

NuGet Package: DevExpress.Pdf.Core

#Declaration

public IList<PdfBookmark> Bookmarks { get; set; }

#Property Value

Type Description
IList<PdfBookmark>

A list of PdfBookmark objects that are the collection of bookmarks.

#Remarks

A list of bookmarks can’t be null. If you set the Bookmarks property to null, the null reference exception occurs.

#Example

The code sample below creates a bookmark with a destination that displays the eighth page as follows:

bookmark

using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
    // Load a document
    pdfDocumentProcessor.LoadDocument("Demo.pdf");

    // Create a FitB destination that refers to the eighth page
    PdfFitBBoxDestination destination =
       new PdfFitBBoxDestination(pdfDocumentProcessor.Document.Pages[7]);

    // Create a bookmark
    PdfBookmark bookmark = new PdfBookmark();
    bookmark.Title = "Annotations";

    // Associate the bookmark with the created destination
    bookmark.Destination = destination;

    // Add the bookmark to the document collection
    pdfDocumentProcessor.Document.Bookmarks.Add(bookmark);

    // Save the result
    pdfDocumentProcessor.SaveDocument("out.pdf");
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Bookmarks property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also