Skip to main content
All docs
V23.2

PdfLinkAnnotationFacade.SetDestination(PdfDestination) Method

Sets a destination (a reference to a page with specific view parameters) associated with an annotation.

Namespace: DevExpress.Pdf

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

NuGet Package: DevExpress.Pdf.Core

Declaration

public void SetDestination(
    PdfDestination destination
)

Parameters

Name Type Description
destination PdfDestination

The destination to which the link annotation refers.

Remarks

A destination includes the following view parameters:

  • The displayed document page
  • The location of the document window on this page
  • The magnification (zoom factor)

Call one of the following methods to create a destination:

View Parameters Methods
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

The code sample below changes the destination associated with the link annotation:

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

    // Access the first page properties
    PdfPageFacade page = processor.DocumentFacade.Pages[0];

    // Retrieve all link annotations
    var linkAnnotations = page.Annotations.Where(annotation => annotation.Type == PdfAnnotationType.Link);
    foreach (PdfLinkAnnotationFacade linkAnnotation in linkAnnotations)
    {
        // Change destination of a specific annotation
        if (linkAnnotation.Name == "link1")
        {
            PdfFitBBoxDestination newDestination = facade.Pages[2].CreateFitBBoxDestination();
            linkAnnotation.SetDestination(newDestination);
        }
    }
    processor.SaveDocument("..\\..\\Result.pdf");
}
See Also