Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PdfPageFacade.CreateXYZDestination(Single, Single) Method

Creates an XYZ destination. The zoom factor is retained from the previous view.

Namespace: DevExpress.Pdf

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

NuGet Package: DevExpress.Pdf.Core

#Declaration

public PdfXYZDestination CreateXYZDestination(
    float destinationX,
    float destinationY
)

#Parameters

Name Type Description
destinationX Single

The X page coordinate in user coordinate system.

destinationY Single

The Y page coordinate in user coordinate system.

#Returns

Type Description
PdfXYZDestination

The XYZ destination.

#Remarks

The code sample below creates a link annotation with a destination that displays the fifth page as follows:

destination

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

    PdfDocumentFacade documentFacade = pdfDocumentProcessor.DocumentFacade;

    // Create an XYZ destination that refers to the fifth page
    PdfXYZDestination destination =
       documentFacade.Pages[4].CreateXYZDestination(100, 524);

    // Find a specific phrase
    string word = "Type 3 fonts";
    PdfTextSearchResults results = pdfDocumentProcessor.FindText(word);

    // If the phrase is found, obtain its bounding rectangle
    if (results.Status == PdfTextSearchStatus.Found)
    {
        PdfRectangle textRectangle = results.Rectangles[0].BoundingRectangle;

        // Access the first page properties
        PdfPageFacade pageFacade = documentFacade.Pages[0];

        // Create a link annotation associated with the bounding rectangle
        // and destination
        PdfLinkAnnotationFacade pdfLinkAnnotation =
           pageFacade.AddLinkAnnotation(textRectangle, destination);
        pdfLinkAnnotation.HighlightMode = PdfAnnotationHighlightingMode.Push;

        pdfDocumentProcessor.SaveDocument("out.pdf");
    }
}
See Also