Add ellipse annotation

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

Ellipse annotation draws elliptic annotation on a document page as shown in the picture below.

You can use the following methods to set the properties of the EllipseAnnotation class: 

To add an ellipse annotation, follow these steps:

  1. Instantiate the Annotator class. Specify the input document path or stream.
  2. Instantiate EllipseAnnotation class. Specify the appropriate properties (position, page number, etc).
  3. Call the add() method. Specify the EllipseAnnotation class.
  4. Call the save() method. Specify the output document path or stream.

The following code snippet shows how to add EllipseAnnotation to the document:

// This example demonstrates adding ellipse annotation.

// Create an instance of Annotator class
Annotator annotator = new Annotator("inputPath");
try {
    // Create an instance of Reply class and add comments
    Reply reply1 = new Reply();
    reply1.setComment("First comment");
    reply1.setRepliedOn(Calendar.getInstance().getTime());

    Reply reply2 = new Reply();
    reply2.setComment("Second comment");
    reply2.setRepliedOn(Calendar.getInstance().getTime());

    java.util.List<Reply> replies =  new ArrayList<Reply>();
    replies.add(reply1);
    replies.add(reply2);

    // Create an instance of EllipseAnnotation class and set options
    EllipseAnnotation ellipse = new EllipseAnnotation();
    ellipse.setBackgroundColor(65535);
    ellipse.setBox(new Rectangle(100, 100, 100, 100));
    ellipse.setCreatedOn(Calendar.getInstance().getTime());
    ellipse.setMessage("This is ellipse annotation");
    ellipse.setOpacity(0.7);
    ellipse.setPageNumber(0);
    ellipse.setPenColor(65535);
    ellipse.setPenStyle(PenStyle.Dot);
    ellipse.setPenWidth((byte) 3);
    ellipse.setReplies(replies);
    
    // Add annotation and save to file
    annotator.add(ellipse);
    annotator.save("outputPath");
} finally {
    if (annotator != null) {
        annotator.dispose();
    }
}

On this page