Skip to main content

GetAllAnnots

Gets all annots on page

Syntax​

expression.GetAllAnnots();

expression - A variable that represents an ApiPage class.

Parameters​

This method doesn't have any parameters.

Returns​

ApiBaseAnnotation[]

Example​

Retrieve all marked comments and notes from a page in a PDF.

// Useful for accessing all the annotations in a PDF.

// List every comment attached to the current page in a PDF.

let doc = Api.GetDocument();
let freeTextAnnot = Api.CreateFreeTextAnnot([10, 10, 160, 32]);
doc.AddPage(0);
let page = doc.GetPage(0);
page.AddObject(freeTextAnnot);

let annots = page.GetAllAnnots();
annots[annots.length - 1].SetPosition({x: 30, y: 30});