Document Processing SDKs

Annotate PDF Documents with Java

Add and manage annotations in PDF files programmatically — no Adobe Acrobat required.

How to Annotate a PDF in Java

GroupDocs.Annotation for Java makes it easy to annotate PDF documents:

  1. Open the PDF with an Annotator instance.
  2. Create and configure the annotation you need.
  3. Add the annotation to the document.
  4. Save the annotated PDF.
// Annotate a PDF document

// Open the PDF with an Annotator instance
Annotator annotator = new Annotator("input.pdf");
try {
    // Create an area annotation
    AreaAnnotation area = new AreaAnnotation();
    area.setBox(new Rectangle(100, 100, 200, 80));
    area.setBackgroundColor(65535);
    area.setPageNumber(0);
    area.setMessage("Important");

    // Add the annotation
    annotator.add(area);

    // Save the annotated PDF
    annotator.save("annotated.pdf");
} finally {
    annotator.dispose();
}
implementation 'com.groupdocs:groupdocs-annotation:25.6.0'
click to copy
copied
More examples Documentation

Full Control Over PDF Annotations

Add every annotation type to PDF documents and manage them with a simple API.

Annotate PDF documents

Text Markup

Highlight, underline, strike out, or replace text in PDF files.

Shapes & Watermarks

Draw shapes and stamp watermarks or images onto PDF pages.

Manage Annotations

Get, remove, import, and export PDF annotations.

Read PDF Annotations

Retrieve the annotations stored in an annotated PDF document:

Java

//  Open the annotated PDF
Annotator annotator = new Annotator("annotated.pdf");
try {
    // Get all annotations
    List<AnnotationBase> annotations = annotator.get();

    // Inspect each annotation
    for (AnnotationBase annotation : annotations) {
        System.out.println(annotation.getMessage());
    }

    // Save the document
    annotator.save("output.pdf");
} finally {
    annotator.dispose();
}
implementation 'com.groupdocs:groupdocs-annotation:25.6.0'
click to copy
copied
More examples Documentation

Annotate PDF Files

GroupDocs.Annotation for Java lets you add, edit, and remove annotations in PDF documents. Highlight or strike out text, draw area and shape annotations, stamp watermarks and images, and attach threaded comments — then save the result back to PDF.
Learn more
About illustration

Ready to get started?

Download GroupDocs.Annotation for free or get a trial license for full access!

Useful resources

Explore documentation, code samples, and community support to enhance your experience.

Annotate Other File Formats

GroupDocs.Annotation for Java supports annotating documents across many file formats:

Temporary license tips

1
Sign up with your work email.
Free mail services are not allowed.
2
Use Get a temporary license button on the second step.
 English