Add image annotation
Leave feedback
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:
- Instantiate the Annotator class. Specify the input document path or stream.
- Instantiate the ImageAnnotation class. Specify the appropriate properties (position, page number, etc).
- Call the Add method. Specify the ImageAnnotation class.
- 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");
}
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.