On this page
Guides
Delete Annotations
The steps to delete an annotation are as follows:
- Obtain the page object where the annotation needs to be deleted.
- Access the list of annotations on that page.
- Locate the desired annotation in the annotation list.
- Delete the identified annotation.
This example shows how to delete annotations:
java
// Retrieve the page object for annotating.
CPDFPage page = document.pageAtIndex(0);
// Retrieve the list of annotations for the page.
List<CPDFAnnotation> annotations = page.getAnnotations();
if (annotations != null && annotations.size() > 0) {
// Locate the desired annotation in the list and remove it.
page.deleteAnnotation(annotations.get(0));
}