There are a few breaking changes when migrating to v6 from older versions.
No more jQuery
CoreControls.js is no longer dependent on jQuery, thus all APIs that use jQuery are changed.
Event handling
The jQuery e isn't passed to event handlers as the first argument anymore. The imported property for annotationChanged is now accessible on the third argument.
The innerElement of all widget annotations is now a normal DOM element instead of a jQuery wrapped element. This means that createInnerElement should return a normal DOM element now.
jQuery is no longer accessible inside a config file. The viewerLoaded and documentLoaded events are triggered on the window instead of the wrapped document object now.
Previously this API didn't wait for the resources to be loaded for annotations before exporting them, which may result in an empty ImageData property for stamp annotations. Now this API waits for it internally. This API is deprecated in favor of exportAnnotCommand.
AnnotationManager exportAnnotations is asynchronous
Previously this API didn't wait for the freehand tool to finish drawing before exporting the XFDF, which may result in missing freehand annotations data. It didn't wait for the resources to be loaded as described above. Now the API waits for it internally.
AnnotationManager importAnnotationsAsync is replaced with importAnnotations
JavaScript
1// Version 5.x and older
2const xfdfString = '...';
3const options = {...};
4
5annotManager.importAnnotationsAsync(
6 xfdfString,
7 importedAnnotations => {
8 ...
9 },
10 options,
11);
12
13// Version 6.0 and after
14annotManager
15 .importAnnotations(xfdfString, options)
16 .then(importedAnnotations => {
17 ...
18 });
The Annotations.Annotation Custom property
The Custom property is mainly used to store a custom property to an annotation. Prior to 6.0 you need to extend Annotations.Annotation's serialize and deserialize methods to make sure that this property shows in the exported XFDF. In 6.0 we replace this property with CustomData. The value of it will be serialized to the output XFDF, and even better, be preserved in the downloaded document.