Add image 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

Image annotation allows you to add an image on document page as shown in the picture below:

You can set the following properties of the ImageAnnotation class:

  • ImagePath defines the image local or remote path
  • Box defines the annotation position on the page using the Rectangle structure (image will be resized for specified width and height)
  • Opacity allows you to set the annotation opacity (present in all supported formats, examples of it you can see above)
  • Angle defines the annotation rotation angle

To add an image annotation, follow these steps:

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

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

using (Annotator annotator = new Annotator("input.pdf"))
            {
                ImageAnnotation area = new ImageAnnotation
                {
                    Box = new Rectangle(100, 100, 100, 100),
                    Opacity = 0.7,
                    PageNumber = 0,
                    ImagePath = "www.google.com.ua/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png",
                    Angle = 100
                };
                annotator.Add(area);
                annotator.Save("result.pdf");
            }

On this page