Here are the key reasons to use the new updated API provided by GroupDocs.Annotation for .NET since version 19.8:
The Annotator class introduced as a single entry point to manage the document annotating process to any supported file format (instead of AnnotationImageHandler class in previous versions).
The overall rendering speed improved dramatically by saving rendered page as soon as it was rendered, not when all pages list were rendered.
Document saving options simplified so it is easy to instantiate proper options class and to control over document annotating and saving processes.
How to migrate?
Here is a brief comparison of how to annotate document and save it using old and new API.
Old coding style
// Creating annotation listList<AnnotationInfo>annotations=newList<AnnotationInfo>(){newAnnotationInfo(){PageNumber=0,Box=newRectangle(100,100,100,100),Type=Domain.AnnotationType.Area,Text="area"},newAnnotationInfo(){PageNumber=0,Box=newRectangle(200,200,80,80),Type=Domain.AnnotationType.Ellipse,Text="ellipse"}};// Create annotation configAnnotationConfigconfig=newAnnotationConfig();// Set storage pathconfig.StoragePath="storage";// Create annotation handlerAnnotationImageHandlerannotator=newAnnotationImageHandler(config);// Create input fileusing(FileStreamfs=newFileStream("input.pdf",FileMode.Open)){// Export annotations and save resultStreamresult=annotator.ExportAnnotationsToDocument(fs,annotations);}
New coding style
// Create list of annotationsList<AnnotationBase>annotations=newList<AnnotationBase>(){newAreaAnnotation(){PageNumber=0,Box=newRectangle(100,100,100,100),Message="area"},newEllipseAnnotation(){PageNumber=0,Box=newRectangle(200,200,80,80),Message="ellipse"}};// Create annotatorusing(Annotatorannotator=newAnnotator("input.pdf")){// Add annotationsannotator.Add(annotations);// Save result to "result.pdf"annotator.Save("result.pdf",newSaveOptions());}