Annotations are stored in a vector within each page of a PDF document. Here is sample code to loop through annotations contained in each page and output information about each annotation including annotation type, creator, date modified, color, bounds using Qoppa’s Java library jPDFProcess. This code can be adapted to work with Qoppa’s PDF components, jPDFEditor, jPDFNotes and jPDFViewer.

for (int i = 0; i < pdfDoc.getPageCount(); i++) {
PDFPage p = pdfDoc.getPage(i);
Vector<Annotation> annots = p.getAnnotations();
if(annots != null)
{
	System.out.println("*** Page " + (i+1) +" contains " + p.getAnnotations().size() + " annotations ***");
	for(int count = 0; count < annots.size(); count++)
	{
		Annotation annot = annots.get(count);
		System.out.println("Annot Number " + (count + 1));
		System.out.println("Type: " + annot.getSubtype());
		System.out.println("Color: " + annot.getColor());
		System.out.println("Creator: " + annot.getCreator());
		System.out.println("Modified Date: " + annot.getModifiedDate());
		System.out.println("Location: " + annot.getRectangle());
		System.out.println("Contents: " + annot.getContents());
	}
}
}

Here is the output of this program for a sample PDF document

***Page 1 contains 14 annotations***
Annot Number 1
Type: FreeText
Color: null
Creator:
Modified Date: Wed Aug 17 07:41:18 EDT 2016
Location: java.awt.geom.Rectangle2D$Double[x=0.0,y=0.0,w=0.0,h=0.0]
Contents: My free text content1
Annot Number 2
Type: FreeText
Color: java.awt.Color[r=255,g=255,b=255]
Creator: Chris
Modified Date: Wed Aug 17 09:57:51 EDT 2016
Location: java.awt.geom.Rectangle2D$Double[x=173.375,y=119.18599999999992,w=287.691,h=122.52200000000005]
Contents: My free text content2
Annot Number 3
Type: FreeText
Color: java.awt.Color[r=255,g=255,b=255]
Creator: Chris
Modified Date: Wed Aug 17 10:00:22 EDT 2016
Location: java.awt.geom.Rectangle2D$Double[x=173.55100000000002,y=274.501,w=273.80999999999995,h=145.894]
Contents: My free text content3
Annot Number 4
Type: Line
Color: java.awt.Color[r=255,g=0,b=0]
Creator: Chris
Modified Date: Wed Aug 17 09:59:59 EDT 2016
Location: java.awt.geom.Rectangle2D$Double[x=313.254,y=152.83999999999992,w=143.06399999999996,h=15.148000000000138]
Contents: My line content
Annot Number 5
Type: FreeText
Color: null
Creator: Chris
Modified Date: Wed Aug 17 09:59:07 EDT 2016
Location: java.awt.geom.Rectangle2D$Double[x=327.742,y=33.96199999999999,w=103.382,h=16.259999999999877]
Annot Number 6
Type: Text
Color: java.awt.Color[r=255,g=255,b=0]
Creator: Chris
Modified Date: Wed Aug 17 09:59:48 EDT 2016
Location: java.awt.geom.Rectangle2D$Double[x=358.33799999999997,y=82.45400000000006,w=13.0,h=18.0]
Annot Number 7
Type: PolyLine
Color: java.awt.Color[r=255,g=0,b=0]
Creator: Chris
Modified Date: Wed Aug 17 10:01:20 EDT 2016
Location: java.awt.geom.Rectangle2D$Double[x=163.563,y=26.658000000000015,w=76.67500000000001,h=82.207]
Annot Number 8
Type: Polygon
Color: java.awt.Color[r=255,g=0,b=0]
Creator: Chris
Modified Date: Wed Aug 17 10:01:40 EDT 2016
Location: java.awt.geom.Rectangle2D$Double[x=23.2004,y=198.13499999999988,w=132.68160000000003,h=255.0660000000001]
Annot Number 9
Type: Ink
Color: java.awt.Color[r=255,g=0,b=0]
Creator: Chris
Modified Date: Wed Aug 17 10:01:59 EDT 2016
Location: java.awt.geom.Rectangle2D$Double[x=259.52299999999997,y=460.26399999999995,w=149.52600000000007,h=92.00199999999995]
Annot Number 10
Type: Circle
Color: java.awt.Color[r=255,g=0,b=0]
Creator: Chris
Modified Date: Wed Aug 17 10:02:16 EDT 2016
Location: java.awt.geom.Rectangle2D$Double[x=495.953,y=271.2359999999999,w=71.52700000000004,h=99.18400000000008]
Annot Number 11
Type: Square
Color: java.awt.Color[r=255,g=0,b=0]
Creator: Chris
Modified Date: Wed Aug 17 10:02:27 EDT 2016
Location: java.awt.geom.Rectangle2D$Double[x=423.35200000000003,y=444.09599999999995,w=117.85399999999998,h=119.92700000000002]
Annot Number 12
Type: Stamp
Color: java.awt.Color[r=255,g=0,b=0]
Creator: Chris
Modified Date: Wed Aug 17 10:02:57 EDT 2016
Location: java.awt.geom.Rectangle2D$Double[x=26.5292,y=504.892,w=176.4998,h=49.500999999999976]
Annot Number 13
Type: StrikeOut
Color: java.awt.Color[r=0,g=0,b=255]
Creator: Chris
Modified Date: Wed Aug 17 10:03:04 EDT 2016
Location: java.awt.geom.Rectangle2D$Double[x=49.35339999999999,y=92.83999999999992,w=120.00560000000002,h=81.0]
Annot Number 14
Type: Caret
Color: java.awt.Color[r=0,g=0,b=255]
Creator: Chris
Modified Date: Wed Aug 17 10:03:13 EDT 2016
Location: java.awt.geom.Rectangle2D$Double[x=118.728,y=125.77999999999997,w=58.320999999999984,h=47.51999999999998]
*** Page 2 contains 0 annotations ***
*** Page 3 contains 0 annotations ***