Android
ComPDFKit PDF SDK
Guides

Access Annotations

 

CPDFAnnotation is the base class for all annotations. A CPDFAnnotation object by itself is not useful, only subclasses (like CPDFCircleAnnotation, CPDFTextAnnotation) are interesting. In parsing a PDF however, any unknown or unsupported annotations will be filtered out.

 

To access the list of annotation by using the following method:

CPDFDocument doc = readerView.getPDFDocument();
int pageCount = doc.getPageCount();
if (pageCount > 0){
 for (int pageIndex = 0; pageIndex < pageCount; pageIndex++) {
   List<CPDFAnnotation> annotations = doc.pageAtIndex(pageIndex).getAnnotations();
   if (annotations != null && !annotations.isEmpty() ){
     for (CPDFAnnotation annotation:annotations){
       // do something
    }
  }
}
}

 

The elements of the array will most likely be typed to subclasses of the CPDFPage class.