GroupDocs.Annotation for .NET 20.2 Release Notes
Major Features
Below is the list of most notable changes in release of GroupDocs.Annotation for .NET 20.2:
- Implemented ability to add Image Annotations to Diagrams
- Added overloads for Remove method
- Implement image extracting of ImageAnnotation
- Fixed support DWG files
- Fixed issue with encrypted SpreadSheet(Cells) files
Full List of Issues Covering all Changes in this Release
Key | Summary | Issue Type |
---|---|---|
ANNOTATIONNET-884 | Implement ability to add Image annotation to Diagrams | Feature |
ANNOTATIONNET-1241 | Add overloads for Annotator Remove Method | Improvement |
ANNOTATIONNET-1248 | Implement image extracting to ImageAnnotation | Improvement |
ANNOTATIONNET-1240 | Fix Dwg File Support | Bug |
ANNOTATIONNET-1242 | Distance annotation was added in wrong place in jpg file | Bug |
ANNOTATIONNET-1243 | Font color was changed after removing text redaction annotation | Bug |
ANNOTATIONNET-1245 | Remove residual files after Image Annotation work | Bug |
ANNOTATIONNET-1246 | Encrypted SpreadSheet(Cells) files throws exception | Bug |
ANNOTATIONNET-1247 | Issue with AnnotationType byte Flag | Bug |
ANNOTATIONNET-1257 | Exception while deleting work files when adding ImageAnntation | Bug |
Public API and Backward Incompatible Changes
Extract Image from Image Annotation
Added new method that allows to get image (.NET class System.Drawing.Image) from annotated Document
Follow these steps to Extract Image:
- Instantiate Annotator object with input document path or stream;
- Call Get method and get annotations list
- Call GetImage method from some of ImageAnnotations from annotations list
- Save image if it needed using Save Method. You can also use Property ImageExtension of ImageAnnotation to set correct image extension
The following code demonstrates how to get image from Image Annotation:
using (Annotator annotator = new Annotator("result.xlsx")) { var tmp = annotator.Get(AnnotationType.Image); ImageAnnotation img = tmp[0] as ImageAnnotation; img.GetImage().Save($"res.{img.ImageExtension}"); }
Added new overloads for Get method
On version 20.2 was added new overload of Annotator.Get method. It allows to get list of annotation of specific type
using (Annotator annotator = new Annotator("annotated.pdf")) { //List with only Annotations with type Area will be returned and saved as tmp variable var tmp = annotator.Get(AnnotationType.Area); }
Added new overloads for Remove method
On version 20.2 Was added new overload of Annotator.Remove method. New overloads method allow to remove single Annotation or list of Annotations. Follow these steps to add annotation to document:- Instantiate Annotator object with input document path or stream;
- Call Remove method and give them id, list of id’s, annotation to delete, or list of annotations
- Call Save method to save changes
- Following code demonstrates overload how to remove Annotation from Document using annotation index:
using (Annotator annotator = new Annotator("result.xlsx")) { annotator.Remove(0); annotator.Save("removed.xlsx"); }
- Following code demonstrates overload how to remove Annotation from Document using Annotation Object:
using (Annotator annotator = new Annotator("result.xlsx")) { var tmp = annotator.Get(); annotator.Remove(tmp[0]); annotator.Save("removed.xlsx"); }
- Following code demonstrates overload how to remove some Annotations from Document using list of Id’s:
using (Annotator annotator = new Annotator("result.xlsx")) { var idList = new List<int>{1, 2, 3}; annotator.Remove(idList); annotator.Save("removed.xlsx"); }
- Following code demonstrates how to remove some Annotations from Document using list of Annotations:
using (Annotator annotator = new Annotator("result.xlsx")) { var tmp = annotator.Get(); annotator.Remove(tmp); annotator.Save("removed.xlsx"); }