Check if a document contains annotations
To check if a document contains annotations, use Instance#getAnnotations
to retrieve the annotations for each page. Then, flatten the array and evaluate the resulting array to see whether or not it’s empty:
PSPDFKit.load({ // Your configuration.}).then(async (instance) => { const pagesAnnotations = await Promise.all( Array.from({ length: instance.totalPageCount }).map((_, pageIndex) => instance.getAnnotations(pageIndex)) );
const allAnnotations = pagesAnnotations .map((pageList) => pageList.toJS()) .flat();
const hasAnnotations = allAnnotations.length > 0;});
This has been tested with Nutrient Web SDK 2020.5.1.