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

KeySummaryIssue Type
ANNOTATIONNET-884Implement ability to add Image annotation to DiagramsFeature
ANNOTATIONNET-1241Add overloads for Annotator Remove MethodImprovement
ANNOTATIONNET-1248Implement image extracting to ImageAnnotationImprovement
ANNOTATIONNET-1240Fix Dwg File SupportBug
ANNOTATIONNET-1242Distance annotation was added in wrong place in jpg fileBug
ANNOTATIONNET-1243Font color was changed after removing text redaction annotationBug
ANNOTATIONNET-1245Remove residual files after Image Annotation workBug
ANNOTATIONNET-1246Encrypted SpreadSheet(Cells) files throws exceptionBug
ANNOTATIONNET-1247Issue with AnnotationType byte FlagBug
ANNOTATIONNET-1257Exception while deleting work files when adding ImageAnntationBug

Public API and Backward Incompatible Changes

  1. 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}");
    }
    
  2. 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);            
    }
    
  3. 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
    1. 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");
    }
    
    1. 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");
    }
    
    1. 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");
    }
    
    1. 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");
    }