Information about a document's annotations can be retrieved with the following APIs.
You can get the total number of unread messages with the
Document.unreadCount property. This is useful for display an unread message icon in your UI.
Events are triggered whenever this value is changed, so you can keep your UI up to date in real time. See this guide for more information.
To check if a singular annotation is unread, use the Annotation.isRead property.
You can use the
Document.markAllAnnotationsAsRead API to set all annotations in the document to read.
This will update the unread annotation count of the document.
You can use the
maxAnnotationSize constructor option to set the maximum annotation size that is allowed to create in bytes.
In certain scenarios, you may want to allow the user to create annotations without having them sync to the database and other users.
You can prevent annotations from being synced by using the
This function accepts an
action (either "add", "modify" or "delete") and the WebViewer Annotation. Return
true from this function if you want the annotation to be synced to the database as normal, or return
false if the annotation should only be kept locally and not stored in the database.
false from this function, the annotation will still be drawn locally for the current user.
This function can be asynchronous.
Prevent new highlight annotations from being synced to the database:
Annotations can be copied from one document to another by using the
This API will copy any annotations to the new document that don't already exist.
You may only want to copy certain annotations to another document. To accomplish this, pass a second
annotationFilter parameter to
copyAnnotationsToDocument. This function is used to filter the annotations that are copied over. The function accepts a WebViewer Annotation and must return a boolean representing if that annotation should be copied over or not.
Only copy rectangle annotations
Only copy annotations with "approved" status