Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

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.v21.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

This example shows how to create bookmarks with destinations in code:

using DevExpress.Pdf;

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    // Load a document
    processor.LoadDocument("..\\..\\Document.pdf");

    // Create destinations
    PdfDestination destination1 = processor.CreateDestination(1, 180, 150);
    PdfDestination destination2 = processor.CreateDestination(1, 168, 230);
    PdfDestination destination3 = processor.CreateDestination(1, 20, 350);

    // Associate bookmarks with created destinations
    processor.Document.Bookmarks.Add(new PdfBookmark()
         { Title = "PDF Document Processor", Destination = destination1 });
    processor.Document.Bookmarks.Add(new PdfBookmark()
         { Title = "Display, Print and Export PDF Documents", Destination = destination2 });
    processor.Document.Bookmarks.Add(new PdfBookmark()
         { Title = "Learn More", Destination = destination3 });

    // Save the result document
    processor.SaveDocument("..\\..\\Result.pdf");
}
See Also