Back to Devexpress

PdfBookmark.Destination Property

officefileapi-devexpress-dot-pdf-dot-pdfbookmark.md

latest4.6 KB
Original Source

PdfBookmark.Destination Property

Gets or sets a destination with which a bookmark is associated.

Namespace : DevExpress.Pdf

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

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public PdfDestination Destination { get; set; }
vb
Public Property Destination As PdfDestination

Property Value

TypeDescription
PdfDestination

A destination.

|

Remarks

A destination includes the following view parameters:

  • The displayed document page
  • View parameters: a view mode or a specific point/region on the page to which to navigate
  • The magnification (zoom factor)

Call one of the following methods to create a destination:

View ParametersMethods
Fit the page’s bounding box to the document window both horizontally and vertically.PdfPageFacade.CreateFitBBoxDestination
Fit the page’s bounding box to the document window horizontally.PdfPageFacade.CreateFitBBoxHorizontallyDestination
Fit the page’s bounding box to the document window vertically.PdfPageFacade.CreateFitBBoxVerticallyDestination
Fit the entire page to the document window both horizontally and vertically ( Zoom to Page Level view).PdfPageFacade.CreateFitDestination
Fit the entire page to the document window horizontally.PdfPageFacade.CreateFitHorizontallyDestination
Fit the entire page to the document window vertically.PdfPageFacade.CreateFitVerticallyDestination
Display the specified page area in the document window.PdfPageFacade.CreateFitRectangleDestination
Position the specified page coordinate at the top left document window corner, and specify the zoom factor.PdfPageFacade.CreateXYZDestination

Example

The following code snippet creates a bookmark with a destination that displays the eighth page as follows:

csharp
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");
}
vb
Using pdfDocumentProcessor As New PdfDocumentProcessor()
  ' Load a document
  pdfDocumentProcessor.LoadDocument("Demo.pdf")

  ' Create a FitB destination that refers to the eighth page
  Dim destination As New PdfFitBBoxDestination
    (pdfDocumentProcessor.Document.Pages(1))

  ' Create a bookmark
  Dim bookmark As New PdfBookmark()
  bookmark.Title = "Annotations"

  ' Associate the bookmark with the created destination
  bookmark.Destination = destination

  ' Add a bookmark to the document collection
  pdfDocumentProcessor.Document.Bookmarks.Add(bookmark)

  ' Save the result
  pdfDocumentProcessor.SaveDocument("out.pdf")
End Using

See Also

PdfBookmark Class

PdfBookmark Members

DevExpress.Pdf Namespace