Add image annotation
Leave feedback
On this page
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 = "www.google.com.ua/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png",
Angle = 100
};
annotator.Add(area);
annotator.Save("result.pdf");
}
To learn more about document annotating features, please refer to the advanced usage section.
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Annotation for .NET examples, plugins, and showcase
- GroupDocs.Annotation for Java examples, plugins, and showcase
- Document Annotation for .NET MVC UI Example
- Document Annotation for .NET App WebForms UI Modern Example
- Document Annotation for Java App Dropwizard UI Modern Example
- Document Annotation for Java Spring UI Example
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.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.