Search results

PdfDocumentLinkAnnotation API in JavaScript (ES5) Pdf Export API control

PdfDocumentLinkAnnotation class represents an annotation object with holds link on another location within a document.

// create a new PDF document
let document : PdfDocument = new PdfDocument();
// create new pages
let page1 : PdfPage = document.pages.add();
let page2 : PdfPage = document.pages.add();
// create a new rectangle
let bounds : RectangleF = new RectangleF({x : 10, y : 200}, {width : 300, height : 25});
//
// create a new document link annotation
let documentLinkAnnotation : PdfDocumentLinkAnnotation = new PdfDocumentLinkAnnotation(bounds);
// set the annotation text
documentLinkAnnotation.text = 'Document link annotation';
// set the destination
documentLinkAnnotation.destination = new PdfDestination(page2);
// set the documentlink annotation location
documentLinkAnnotation.destination.location = new PointF(10, 0);
// add this annotation to a new page
page1.annotations.add(documentLinkAnnotation);
//
// save the document to disk
document.save('output.pdf');
// destroy the document
document.destroy();

Properties

destination PdfDestination

Gets or sets the destination of the annotation.

// create a new PDF document
let document : PdfDocument = new PdfDocument();
// create new pages
let page1 : PdfPage = document.pages.add();
let page2 : PdfPage = document.pages.add();
// create a new rectangle
let bounds : RectangleF = new RectangleF({x : 10, y : 200}, {width : 300, height : 25});
//
// create a new document link annotation
let documentLinkAnnotation : PdfDocumentLinkAnnotation = new PdfDocumentLinkAnnotation(bounds);
// set the annotation text
documentLinkAnnotation.text = 'Document link annotation';
// set the destination
documentLinkAnnotation.destination = new PdfDestination(page2);
// set the documentlink annotation location
documentLinkAnnotation.destination.location = new PointF(10, 0);
// add this annotation to a new page
page1.annotations.add(documentLinkAnnotation);
//
// save the document to disk
document.save('output.pdf');
// destroy the document
document.destroy();