Remove annotation from document using JavaScript

To remove an annotation from a document.

JavaScript

1async function main() {
2 const doc = await PDFNet.PDFDoc.createFromURL(filename);
3 const page = await doc.getPage(1);
4
5 // remove by index
6 await page.annotRemove(0);
7
8 // remove by annotation
9 const annotation = await page.getAnnot(0);
10 await page.annotRemove(annotation);
11}
12PDFNet.runWithCleanup(main);

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales