[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Collapse]Office File API
  Demo Application
  Redistribution and Deployment
 [Expand]Spreadsheet Document API
 [Expand]Word Processing Document API
 [Collapse]PDF Document API
   Getting Started
   Coordinate Systems
   Document Generation
  [Expand]PDF Graphics
  [Expand]Document Manipulation
  [Collapse]Additional Content
    Bookmarks
    Hyperlinks
    Attachments
  [Expand]Interactive Forms
  [Expand]Text Markup Annotations
  [Expand]Document Security
  [Expand]Examples
 [Expand]Excel Export Library
 [Expand]Snap Report API
 [Expand]Zip Compression and Archive API
 [Expand]Barcode Generation API
 [Expand]Unit Conversion API
 [Expand]API Reference
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Bookmarks

The PDF Document API provides properties and methods for generating new bookmarks or editing existing document's bookmarks in code.

Expanded Overview

A PdfBookmark class instance represents a bookmark. It can be accessed as an item of the PdfBookmark objects list returned by the PdfDocument.Bookmarks property. The PdfBookmark class contains the following properties to customize bookmarks:

Member Description
PdfBookmark.Action Provides access to the bookmark action being executed.
PdfBookmark.Children Gets or sets the collection of bookmark children for a document with a tree-structured hierarchy.
PdfBookmark.Destination Gets or sets a destination (a particular view of a document) to which a bookmark is referred to.
PdfBookmark.IsBold Gets or sets the value indicating whether the bookmark text is bold.
PdfBookmark.IsItalic Gets or sets the value indicating whether the bookmark text is italic.
PdfBookmark.IsInitiallyClosed Gets or sets a value that indicates whether bookmarks are initially closed (bookmark children are hidden) in the navigation panel after a document is loaded.
PdfBookmark.TextColor Gets or sets the color for a bookmark's text in the navigation pane.
PdfBookmark.Title Gets or sets the bookmark's text on the navigation pane.

Expanded Creating a Bookmark Destination

Call an overloaded PdfDocumentProcessor.CreateDestination method to create a destination to which a bookmark should be linked. The PDF Document API component can create following types of the destinations:

The created destination is assigned to the PdfBookmark.Destination property.

The overloaded PdfDocumentProcessor.CreateDestination methods use the world coordinate system. The world coordinate system's origin (0,0) is at the top left of the page. A positive x increases towards the right and a positive y towards the bottom. So, if you want to pass the page coordinates for a destination to one of the PdfDocumentProcessor.CreateDestination methods as arguments, you need to convert these page coordinates to world coordinates. See Coordinate Systems for more information.

When the overloaded PdfDocumentProcessor.CreateDestination methods create a destination represented by the PdfDestination object, the world coordinates are converted to page coordinates (see Coordinate Systems for details). To convert the world coordinates (units) into a physical value such as inches, these methods need the resolution's value (dpi) to be passed as dpiX and dpiY parameters. The default resolution is 96 dpi if no value is passed to these methods.

Since the measurement unit in the page coordinate system is a point (1/72 of an inch), pass 72 as dpiX and dpiY values to one of the PdfDocumentProcessor.CreateDestination methods.

Example

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T495077.

This example shows how to create bookmarks in code and add them to a document.

To do this:

Note

The measurement unit in the destination is equal to 1/72 of an inch.

Expanded See Also

Is this topic helpful?​​​​​​​