Compare annotations

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Annotation MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-annotation -- dnx GroupDocs.Annotation.Mcp --yes
Folders, licensing and more →

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));
    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++) {
        // Compare annotations
        if (imageAnnotation.equals(annotations.get(i))) {
                // Do some stuff here...
        }
    }
}

On this page