Delete Image stamp annotation programatically

Hello,

Is it possible to delete just image type stamp programatically
for all authors?
if not then can you suggest any way to achieve it.

Regards
Abhishek Maurya

Hi,

To delete all the stamp annotations you can use getAnnotationsList to get a list of all the annotations, then filter to select only the stamp annotations, and then delete them with deleteAnnotations.

Webviewer({
  initialDoc: hashFile,
  path: '/lib',
}, document.getElementById('viewer')).then(instance => {

  const { annotManager, docViewer, Annotations } = instance;
  docViewer.on('documentLoaded', () => {
    const list = annotManager.getAnnotationsList();
    const toBeDeleted = list.filter(annot => annot instanceof Annotations.StampAnnotation);
    annotManager.deleteAnnotations(toBeDeleted);
  })
});

Thanks,
Logan

Thank you for the solution!

1 Like