Add point annotation

Point annotationsticks comments to any point in a document like shown at the picture below. 

There is an ability to specify the next fields for PointAnnotation type:

  • Box - defines annotation position at document page;

Follow these steps to add Point annotation to document:

  • Instantiate Annotator object with input document path or stream;
  • Instantiate PointAnnotation object with desired properties (position, page number, etc);
  • Call add method and pass PointAnnotation object;
  • Call save method with resultant document path or stream.

The following code demonstrates how to add PointAnnotation to the document:

String outputPath = Constants.getOutputFilePath("AddPointAnnotation", FilenameUtils.getExtension(Constants.INPUT));
            final Annotator annotator = new Annotator(Constants.INPUT);
            try {
                Reply reply1 = new Reply();
                reply1.setComment("First comment");
                Reply reply2 = new Reply();
                reply2.setComment("Second comment");
                java.util.List<Reply> replies =  new ArrayList<Reply>();
                PointAnnotation point = new PointAnnotation();
                point.setBox(new Rectangle(100, 100, 0, 0));
                point.setMessage("This is point annotation");
            } finally {
                if (annotator != null) {

More resources

Advanced Usage Topics

To learn more about document annotating features, please refer to the advanced usage section.

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full-featured Java library we provide simple, but powerful free Apps.
You are welcome to annotate your PDF, DOC or DOCX, XLS or XLSX, PPT or PPTX, PNG and other documents with free to use online GroupDocs Annotation App.