GroupDocs.Annotation for .NET 20.1 Release Notes
Major Features
Below is the list of most notable changes in release of GroupDocs.Annotation for .NET 20.1:
- Legacy API was removed from product
- Added new type of annotation - Image Annotation for (SpreadSheet, Diagrams, Images, PDF, WordProcessing, Presentations)
Full List of Issues Covering all Changes in this Release
Key | Summary | Issue Type |
---|---|---|
ANNOTATIONNET-880 | Implement ability to add Image annotation to PDF | Feature |
ANNOTATIONNET-881 | Implement ability to add Image annotation to SpreadSheet | Feature |
ANNOTATIONNET-882 | Implement ability to add Image annotation to Presentations | Feature |
ANNOTATIONNET-883 | Implement ability to add Image annotation to WordProcessing | Feature |
ANNOTATIONNET-1220 | Implement ability to add Image annotation to Images | Feature |
ANNOTATIONNET-1219 | Example Code throws NullReferenceException for SpreadSheet | Bug |
Public API and Backward Incompatible Changes
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. Warning, if you use remote path – you need to remove http and https protocol, or www if it present. This error is now investigating.
Not Correct: https://www.google.com.ua/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png http://www.google.com.ua/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png
Correct: www.google.com.ua/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png google.com.ua/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png
- Box - defines annotation position at document page; (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);
Follow these steps to add Image 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 with remote ImagePath 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"
};
annotator.Add(area);
annotator.Save("result.pdf");
}
The result would be