Skip to content
Guides

Delete Annotations

The steps to delete an annotation are as follows:

  1. Obtain the page object where the annotation needs to be deleted.

  2. Access the list of annotations on that page.

  3. Locate the desired annotation in the annotation list.

  4. 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];