Some test text!

menu
search

Add link annotation

Only available with the Full API

To add a hyperlink or intra-document link annotation to a PDF Document page.

const doc = await PDFNet.PDFDoc.createFromURL(filename);
const firstPage = await doc.getPage(1);

// Create a hyperlink
const createURIAction = await PDFNet.Action.createURI(doc, 'http://www.pdftron.com');
const linkRect = new PDFNet.Rect(85, 570, 503, 524);
const hyperlink = await PDFNet.LinkAnnot.create(doc, linkRect);
await hyperlink.setAction(createURIAction);
await firstPage.annotPushBack(hyperlink);

// Create an intra-document link
const page3 = await doc.getPage(3);
const gotoPage3 = await PDFNet.Action.createGoto(await PDFNet.Destination.createFitH(page3, 0));
const link = await PDFNet.LinkAnnot.create(doc, (new PDFNet.Rect(85, 458, 503, 502)));
await link.setAction(gotoPage3);
await firstPage.annotPushBack(link);

Add or edit PDF annotations sample
Full code sample which shows how to add or edit PDF annotations (e.g. hyperlink, intra-document link, stamp, rubber stamp, file attachment, sound, text, free-text, line, circle, square, polygon, polyline, highlight, squiggly, caret, and ink).

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

PDFTron Receives USD$71 Million Growth Investment Led By Silversmith Capital Partners

Learn more
close