Skip to content
Guides

Edit Annotations

The steps to edit an annotation are as follows:

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

  2. Access the list of annotations on that page.

  3. Locate the desired annotation in the annotation list and convert it.

  4. Set the properties to the annotation object.

  5. Update the annotation appearance to display it on the document.

This example shows how to edit annotations:

swift
var annotations: [CPDFAnnotation] = []

for i in 0..<document?.pageCount ?? 0 {
    // Iterate through all pages.
    if let page = document?.page(at: i) {
        // Iterate through all the annotations on the page.
        annotations += page.annotations
        for annotation in annotations {
            // Process every annotations here.
        }
    }
}
objective-c
NSMutableArray *annotations = [NSMutableArray array];
for (int i=0; i<document.pageCount; i++) {
    // Loop through all anntation
    CPDFPage *page = [document pageAtIndex:i];
    [annotations addObjectsFromArray:[page annotations]];
    for (CPDFAnnotation *annotation in annotations) {
        
    }
}