PdfBookmark Class
Contains settings that are used to specify bookmarks in a document.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Pdf.v22.1.Core.dll
Declaration
Remarks
Use the PdfDocument.Bookmarks property to obtain a list of document bookmarks.
Important
The bookmark hierarchy must contain only distinct instances of the PdfBookmark
class. The following code snippet shows this prohibited action.
Example
The code sample below creates a bookmark with a destination that displays the eighth page as follows:
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");
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the PdfBookmark class.
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.