Compare annotations

On this page

GroupDocs.Annotation v21.7. and later allows you to compare annotations using the Equals method.

The following code snippet shows how to compare annotations:

// This example demonstrates how to update annotation.

// Create an instance of Annotator class
try (Annotator annotator = new Annotator("annotated_file.pdf")) {
    List<AnnotationBase> annotations = annotator.get();
    // Create an instance of the ImageAnnotation class and add options
    ImageAnnotation imageAnnotation = new ImageAnnotation();
    imageAnnotation.setBox(new Rectangle(100, 100, 100, 100));

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

On this page