fromgroupdocs.annotationimportAnnotatordefremove_annotation_by_id():# Open an annotated document and remove a single annotation by its idwithAnnotator("./annotated.pdf")asannotator:annotations=annotator.get()ifannotations:annotator.remove(annotation_id=annotations[0].id)annotator.save("./output.pdf")
fromgroupdocs.annotationimportAnnotatordefremove_annotation_by_object():# Open an annotated document and remove a single annotation by its objectwithAnnotator("./annotated.pdf")asannotator:annotations=annotator.get()ifannotations:annotator.remove(annotation=annotations[0])annotator.save("./output.pdf")
remove
Removes a collection of annotations from the document using the provided annotation IDs.
Iterable of annotation IDs (e.g., list of str) that should be removed.
Example
fromgroupdocs.annotationimportAnnotatordefremove_annotation_by_id():# Open an annotated document and remove a single annotation by its idwithAnnotator("./annotated.pdf")asannotator:annotations=annotator.get()ifannotations:annotator.remove(annotation_id=annotations[0].id)annotator.save("./output.pdf")