PdfDestination
12 Sep 20251 minute to read
PdfDestination class represents the PDF destination.
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Access the annotation at index 0
let annotation: PdfDocumentLinkAnnotation = document.getPage(0).annotations.at(0) as PdfDocumentLinkAnnotation;
// Initializes a new instance of the `PdfDestination` class.
let destination: PdfDestination = new PdfDestination();
// Sets the zoom factor.
destination.zoom = 20;
// Sets the page where the destination is situated.
destination.page = page;
// Sets the mode of the destination.
destination.mode = PdfDestinationMode.fitToPage;
// Sets the location of the destination.
destination.location = [20, 20];
// Sets the bounds of the destination.
destination.destinationBounds = [20, 20, 100, 50];
// Sets destination to document link annotation.
annotation.destination = destination;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();Properties
destinationBounds number[]
Gets the bounds of the destination.
isValid boolean
Gets a value indicating whether this instance is valid (Read only).
location number[]
Gets the location of the destination.
mode PdfDestinationMode
Gets the mode of the destination.
page PdfPage
Gets the page where the destination is situated.
pageIndex number
Gets the page index of bookmark destination (Read only).
zoom number
Gets the zoom factor.