Some test text!

menu

Edit annotation style properties using JavaScript

Only available with the Full API

To set an annotation style property such as color, interior color, border style, padding, etc to an annotation.

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

const circle = await PDFNet.CircleAnnot.create(doc, new PDFNet.Rect(100, 100, 200, 200));
circle.setColor((await PDFNet.ColorPt.init(0, 1, 0)), 3);
circle.setInteriorColor((await PDFNet.ColorPt.init(0, 0, 1)), 3);
const dash = [2, 4];
circle.setBorderStyle((await PDFNet.AnnotBorderStyle.createWithDashPattern(PDFNet.AnnotBorderStyle.Style.e_dashed, 3, 0, 0, dash)));
circle.setPadding(new PDFNet.Rect(2, 2, 2, 2));
circle.refreshAppearance();
page.annotPushBack(circle);

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.