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.CreateFitHorizontallyDestination(Single) Method

Creates a FitH destination.

Namespace: DevExpress.Pdf

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

NuGet Package: DevExpress.Pdf.Core

#Declaration

public PdfFitHorizontallyDestination CreateFitHorizontallyDestination(
    float top
)

#Parameters

Name Type Description
top Single

The Y coordinate that is positioned at the top left corner of the document window. Specify this coordinate in the user coordinate system.

#Returns

Type Description
PdfFitHorizontallyDestination

The FitH destination on the page.

#Example

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

fit horizontally

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

    // Access first page properties
    PdfPageFacade pageFacade = pdfDocumentProcessor.DocumentFacade.Pages[0];

    // Access third page properties
    PdfPageFacade destinationPageFacade =
      pdfDocumentProcessor.DocumentFacade.Pages[2];

    // Create a FitH destination that refers to the fourth page
    PdfFitHorizontallyDestination destination =
      destinationPageFacade.CreateFitHorizontallyDestination(134);

    // Find a specific phrase
    string linkText = "Rattlesnake Canyon Grocery Total";
    PdfTextSearchResults linkSearchResults =
      pdfDocumentProcessor.FindText(linkText);

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

        // Create a link annotation associated with the bounding rectangle
        // and destination
        PdfLinkAnnotationFacade pdfLink =
          pageFacade.AddLinkAnnotation(linkRectangle, destination);
        pdfLink.HighlightMode = PdfAnnotationHighlightingMode.Push;
    }
    // Save the result
    pdfDocumentProcessor.SaveDocument("out.pdf");
    }
}
See Also