Windows
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 represented as this base class.

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

 

CPDFDocument document = CPDFDocument.InitWithFilePath("filePath");
int pageCount = document.PageCount;
if(pageCount>0)
{
   for(int pageIndex = 0;pageIndex < pageCount;pageIndex++)
  {
       Listannotations = document.PageAtIndex(pageIndex).GetAnnotations();
       if(annotations != null && annotations.Count != 0)
      {
         foreach(CPDFAnnotation annotation in annotations)
        {
           // do something
        }
    }
  }
}

 

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