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:
swift
// Retrieve the page object for editing the annotation.
if let page = document?.page(at: 0) {
// Retrieve the list of annotations for that page.
if let annotation = page.annotations {
// Delete the identified annotation.
page.removeAnnotation(annotation[0])
}
}
objective-c
// Retrieve the page object for editing the annotation.
CPDFPage *page = [document pageAtIndex:0];
// Retrieve the list of annotations for that page.
CPDFAnnotation *annotation = [[page annotations] objectAtIndex:0];
// Delete the identified annotation.
[page removeAnnotation: annotation];