On this page
Guides
Access Annotations
The steps to access a list of annotations and annotation objects are as follows:
- Obtain the page object.
- Access the list of annotations from the page object.
- Iterate through each annotation object in the list.
This example shows how to access annotations:
Java
CPDFDocument document = new CPDFDocument();
document.open("fileUrl");
int pageCount = document.getPageCount();
if (pageCount > 0){
for (int pageIndex = 0; pageIndex < pageCount; pageIndex++) {
List<CPDFAnnotation> annotations = document.pageAtIndex(pageIndex).getAnnotations();
if (annotations != null && !annotations.isEmpty() ){
for (CPDFAnnotation annotation:annotations){
if (annotation == null || !annotation.isValid()){
continue;
}
// Begin operations on the acquired annotations.
}
}
}
}