GroupDocs.Annotation for Java 21.7 Release Notes
Leave feedback
On this page
Note
This page contains release notes for GroupDocs.Annotation for Java 21.7
Warning
Breaking changes
In this version we’re introducing new public API which was designed to be simple and easy to use. For more details about new API please check Migration Notes and Developer Guide sections.
Major Features
In this version Below the list of most notable changes in release of GroupDocs.Annotation for Java 21.7:
Legacy API was removed from product
Fixed several bugs and issues
Added new type of annotation - Image Annotation for (SpreadSheet, Diagrams, Images, PDF, WordProcessing, Presentations)
Investigated and fixed coordinates of annotations to make them same on images preview as on documents for number of formats (PDF, Cells, Slides, Words)
Adding showing distance value for Distance annotations in different formats (Slides, PDF, Images, Diagrams, Cells)
Fixed Background color for highlight annotation is not set in Images
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
Added new feature for managing different versions of annotated documents (supported formats: Words, PDF, PowerPoint and Open Document format presentations, Excel and Open Document format spreadsheets)
Added advanced rendering options for show\hide replies
Added to new API getting pages image size
Fixed issue with throwing exception for encrypted Excel spreadsheets
Fixed cleanup replies for PowerPoint presentations
Annotation available in document after removing
Issue with generating preview for password-protected document
Issue with error when processing images
Implemented managing different versions of annotated documents for Images and Diagrams
Implemented additional overloads for Save method without filestream
Fixed background opacity for PNG files
Fixed issue with PagesInfo for Excel files in MVC project
Fixed clearing comments for Excel files
Fixed unable to Save document as file that was used to create annotator
Implemented Angle property for Image Annotation
Implemented horizontal and vertical alignment for Watermark
Implemented text horizontal alignment for TextField
Fixed saving only specific annotation types for html, email, words and image
Improved exceptions usage
Fixed incorrect position of text annotations types in Cells
Exception while deleting work files when adding ImageAnntation
Bug
ANNOTATIONNET-1296
Cannot access a closed Stream
Bug
ANNOTATIONNET-1284
Encrypted Excel spreadsheet file throws exception
Bug
ANNOTATIONNET-1321
CleanUp method for PowerPoint presentation does not remove replies
Bug
ANNOTATIONNET-1370
Adding annotations to PNG image makes background non transparent
Bug
ANNOTATIONNET-1368
Unable to Save document as file that was used to create annotator
Bug
ANNOTATIONNET-1367
A generic error occurred in GDI+ when processing Slides documents
Bug
ANNOTATIONNET-1362
TextAnnotations not cleaning in Cells after adding Versions
Bug
ANNOTATIONNET-1361
Comments not cleaned in Excel files
Bug
ANNOTATIONNET-1358
Wrong file metadata issue in Images after adding Versions
Bug
ANNOTATIONNET-1357
Empty PagesInfo for Excel file in MVC project.
Bug
ANNOTATIONJAVA-1217
Exception occurred while remove annotations from xls file
Bug
ANNOTATIONJAVA-1238
Add DWG files support
Bug
ANNOTATIONJAVA-1240
Remove underline annotation doesn’t work
Bug
ANNOTATIONJAVA-1241
Font color was changed after removing text redaction annotation
Bug
ANNOTATIONJAVA-1243
Cannot add annotations to the image.
Bug
ANNOTATIONJAVA-1245
Distance annotation in jpg file
Bug
ANNOTATIONJAVA-1312
Remove annotation via AnnotationType.None dosen’t work
Bug
ANNOTATIONJAVA-1311
Error when save Text Redaction annotation to file
Bug
Public API and Backward Incompatible Changes
Note
This section lists public API changes that were introduced in GroupDocs.Annotation for Java 21.7. It includes not only new and obsoleted public methods, but also a description of any changes in the behavior behind the scenes in GroupDocs.Annotation which may affect existing code. Any behavior introduced that could be seen as a regression and modifies existing behavior is especially important and is documented here.
Add Image Annotation
Image annotation allows to add image within document page like shown at the picture below.
Note
IMPORTANT: On version 20.1 Image Annotation supported only in PDF, Words, Slides, Cells, Images documents.
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.
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
Starting from version 21.7 several Save methods overloads was added for user convenience Now you can call Empty Save to save documents as input file for annotator. If you need to add some options, you may call Save method with only one parameter - SaveOptions, it will do the same as empty but will consider your options.
From this time Annotation Models overload the standard Equals method and also implement the IEquatable interface with the type of the class from which this method is called.
Example how to use it:
try(Annotatorannotator=newAnnotator("annotated_file.pdf")){List<AnnotationBase>annotations=annotator.get();ImageAnnotationimageAnnotation=newImageAnnotation();imageAnnotation.setBox(newRectangle(100,100,100,100));imageAnnotation.setOpacity(0.7);imageAnnotation.setPageNumber(0);imageAnnotation.setImagePath("www.google.com.ua/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png");imageAnnotation.setAngle(100.0);annotator.add(imageAnnotation);annotator.save("result.pdf");for(inti=0;i<annotations.size();i++){if(imageAnnotation.equals(annotations.get(i))){// Do some stuff here...
}}}
Removed the deprecated ImportAnnotations property from the LoadOptions class because annotations are imported automatically.
So, if before version 21.7 this code was correct:
Every Time you Save file using Annotator.Save() method - you implicitly create a new version of the annotated file. Versions List stores not document, it keeps annotations that you add, remove, and change. So you can easy swap between different changes made with GroupDocs.Annotation. And of course you can set your version names. More information about how it works you can find in child Pages
By default, they are created using unique GUID keys. Next, each aspect of using versions will be considered. The API execution logic has not changed, so you do not need to change your code to use it as before. By default, the latest version is loaded without your fate (that is, you will not notice the difference with previous releases).
Backward Compatibility
The update is fully compatible with previous and next updates (The latest saved version will be used), however, using versions on previous versions is not possible and the list of versions in this document will not be changed. And If you update file from 20.4+ using 20.2 and lower few times, after loading this document on 20.4+ only last changes will be added as new version.
Add Version with custom name
If you want to swap between versions easily you might need to have ability to set custom versions names.
Here the code that demonstrates how to save version with custom name:
Annotator.GetVersionList() returns list of objects because it supports any type of key. But if you used some specified keys as string - you can convert it.
Get List of Annotations using version key
If you need to get List of Annotations you can use Annotator.GetVersion() method
Here code that demonstrates how to get list of annotations from individual version
Version Property type is object, so it support any type, and you can use any variable as a version.
Added RenderComments Property to PreviewOptions
If you need not to generate comments on image preview you may use RenderComments property
Note
This feature is only supported for Word processing documents.
Default value is true. If it is not needed to display replies and comments at the page preview - set RenderComments property to false (replies and comments still will be stored inside document). Please notice, that RenderComments value will impact any document comments (doesn’t matter if they were added by GroupDocs.Annotation or some other application).
Here the code that demonstrates how display image preview without comments:
Add PagesInfo property to IDocumentInfoPagesInfo represents list of PageInfo objects which store information about each page.
Now PageInfo have two properties - Width and Height in pixels. This properties works with all formats except Email And Html that doesn’t have height and width so the won’t store them and will be empty. All pages width and height will be same in all formats except Cells, so you can use size of first element as size of all document.
Here code that demonstrates how to get Document width and Height:
Added horizontal and vertical alignment for Watermark
To set Horizontal and Vertical Alignments for WatermarkAnnotation, you can use Alignment properties.