officefileapi-devexpress-dot-pdf-dot-pdfpagefacade-fcfa88d1.md
Creates a FitH destination. The coordinate of the document window’s top left corner is retained from the previous view.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Core.dll
NuGet Package : DevExpress.Pdf.Core
public PdfFitHorizontallyDestination CreateFitHorizontallyDestination()
Public Function CreateFitHorizontallyDestination As PdfFitHorizontallyDestination
| Type | Description |
|---|---|
| PdfFitHorizontallyDestination |
The FitH destination.
|
The code sample below creates a link annotation with a destination that displays the fourth page as follows:
using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
// Load a document
pdfDocumentProcessor.LoadDocument("Demo.pdf");
// Access first page properties
PdfPageFacade pageFacade = pdfDocumentProcessor.DocumentFacade.Pages[0];
// Access destination page properties
PdfPageFacade destinationPageFacade = pdfDocumentProcessor.DocumentFacade.Pages[3];
// Create a FitH destination that refers to the fourth page
PdfFitHorizontallyDestination destination =
destinationPageFacade.CreateFitHorizontallyDestination();
// Find a specific phrase
string linkText = "Transparency groups";
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");
}
Using pdfDocumentProcessor As New PdfDocumentProcessor()
' Load a document
pdfDocumentProcessor.LoadDocument("Demo.pdf")
' Access first page properties
Dim pageFacade As PdfPageFacade = pdfDocumentProcessor.DocumentFacade.Pages(0)
' Access destination page properties
Dim destinationPageFacade As PdfPageFacade = pdfDocumentProcessor.DocumentFacade.Pages(3)
' Create a FitH destination that refers to the fourth page
Dim destination As PdfFitHorizontallyDestination =
destinationPageFacade.CreateFitHorizontallyDestination()
' Find a specific phrase
Dim linkText As String = "Transparency groups"
Dim linkSearchResults As PdfTextSearchResults = pdfDocumentProcessor.FindText(linkText)
' If the phrase is found, obtain its bounding rectangle
If linkSearchResults.Status = PdfTextSearchStatus.Found Then
Dim linkRectangle As PdfRectangle = linkSearchResults.Rectangles(0).BoundingRectangle
' Create a link annotation associated with the bounding rectangle
' and destination
Dim pdfLink As PdfLinkAnnotationFacade =
pageFacade.AddLinkAnnotation(linkRectangle, destination)
pdfLink.HighlightMode = PdfAnnotationHighlightingMode.Push
End If
' Save the result
pdfDocumentProcessor.SaveDocument("out.pdf")
End Using
See Also