Add image annotation

Image annotation allows to add image within document page like shown at the picture below.

There is an ability to specify the next properties for ImageAnnotation type:

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

Follow these steps to add Highlight annotation to document:

  • Instantiate Annotator object with input document path or stream;
  • Instantiate ImageAnnotation object with desired properties (position, page number, etc);
  • Call Add method and pass ImageAnnotation object;
  • Call Save method with resultant document path or stream.

The following code demonstrates 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 = "",
                    Angle = 100

More resources

Advanced Usage Topics

To learn more about document annotating features, please refer to the advanced usage section.

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.