On this page
Guides
Edit Annotations
The steps to edit an annotation are as follows:
Obtain the page object where the annotation needs to be edited.
Access the list of annotations on that page.
Locate the desired annotation in the annotation list and convert it.
Set the properties to the annotation object.
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) {
}
}