PdfPageFacade.CreateFitBBoxDestination() Method
Creates a FitB destination.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Pdf.v24.2.Core.dll
NuGet Package: DevExpress.Pdf.Core
#Declaration
public PdfFitBBoxDestination CreateFitBBoxDestination()
#Returns
Type | Description |
---|---|
Pdf |
The Fit |
#Example
The code sample below creates a link annotation with a destination that displays the eighth page as follows:
using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
// Load a document
pdfDocumentProcessor.LoadDocument("Demo.pdf");
// Access eighth page properties
PdfPageFacade pageFacade = pdfDocumentProcessor.DocumentFacade.Pages[7];
// Create a FitBBox destination that refers to the eighth page
PdfFitBBoxDestination destination = pageFacade.CreateFitBBoxDestination();
// Find a specific phrase
PdfTextSearchResults searchResults = pdfDocumentProcessor.FindText("Annotations");
// If the phrase is found, obtain its bounding rectangle
if (searchResults.Status == PdfTextSearchStatus.Found)
{
PdfPageFacade linkPageFacade =
pdfDocumentProcessor.DocumentFacade.Pages[searchResults.PageNumber - 1];
PdfRectangle annotationRectangle = searchResults.Rectangles[0].BoundingRectangle;
// Create a link annotation associated with the bounding rectangle
// and destination
PdfLinkAnnotationFacade linkAnnotation =
linkPageFacade.AddLinkAnnotation(annotationRectangle, destination);
linkAnnotation.HighlightMode = PdfAnnotationHighlightingMode.Push;
}
// Save the result
pdfDocumentProcessor.SaveDocument("out.pdf");
}