Skip to content
Guides

Access Annotations

The steps to access a list of annotations and annotation objects are as follows:

  1. Obtain the page object.
  2. Access the list of annotations from the page object.
  3. Iterate through each annotation object in the list.

This example shows how to access annotations:

C#
CPDFDocument document = CPDFDocument.InitWithFilePath("filePath");
int pageCount = document.PageCount;
if(pageCount>0)
{
    for(int pageIndex = 0;pageIndex < pageCount;pageIndex++)
    {
    	// Obtain the page object and Access the list of annotations within the page object.
        List<CPDFAnnotation>annotations = document.PageAtIndex(pageIndex).GetAnnotations();
        if(annotations != null && annotations.Count != 0)
        {
          //  Iterate through each annotation object in the list.
          foreach(CPDFAnnotation annotation in annotations)
          {
            //  Perform relevant operations on the obtained annotation objects.
          }
      	}
    }
}