Introduction to Annotations


PSPDFKit Libraries supports most common annotation types:

These are standard annotations (as defined in the PDF Reference) that can be read and written by many apps, including Adobe Acrobat and Apple’s Preview app.

Working with Annotations in Code

The PSPDFKit Java Library uses Instant Annotation JSON to read and write annotations to and from a document, which allows for reusability across many of our products.

When a document is loaded, it’s possible to query the document to return the annotation representation of the document. Using getAnnotationsJson, you will receive a JSONArray populated with the annotation information of the page queried.

For more information on the Annotation JSON format, please see our Server guides.

Creating and Deleting Annotations

To create an annotation on a page, simply use the annotation JSON format to add the annotation you want:

JSONObject annotationJson = new JSONObject();
jsonObject.put("backgroundColor", "#FF0000");
jsonObject.put("bbox", new float[]{10, 10, 400, 400});


jsonObject.put("fontColor", "#000000");
jsonObject.put("fontSize", 72);


To delete an annotation, you need to reference the pageIndex and pdfObjectId of the annotation in the document:

document.getAnnotationProvider().removeAnnotation(0, 1);