Comparing annotations using the equals method

Since from 21.7. You have the ability to compare annotations using the Equals method.

Here is the example of the code:

try (Annotator annotator = new Annotator("annotated_file.pdf")) {
    List<AnnotationBase> annotations = annotator.get();
    ImageAnnotation imageAnnotation = new ImageAnnotation();
    imageAnnotation.setBox(new Rectangle(100, 100, 100, 100));
    imageAnnotation.setOpacity(0.7);
    imageAnnotation.setPageNumber(0);
    imageAnnotation.setImagePath("www.google.com.ua/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png");
    imageAnnotation.setAngle(100.0);

    for(int i = 0; i < annotations.size(); i++) {
        if (imageAnnotation.equals(annotations.get(i))) {
                // Do some stuff here...
        }
    }
}

More resources

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 .NET 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.