By now, you should have setup WebViewer and read all about the DocumentViewer, but a very common use case is interacting with annotations.
The main way to access and work with annotations is through the AnnotationManager. Like with the DocumentViewer when using the WebViewer UI, this is also available through the Core namespace and is one of the main objects you will likely interact with.
Reading annotations
Fetching a list of annotations in the document can be done via the AnnotationManager. This is done through the getAnnotationsList API. This list is the complete list so it will include link annotations and widgets (form controls).
If you are working with user interactions and would like to get the annotations under the cursor at some point, the AnnotationManager provides two methods that will help depending on what you want to do:
When adding annotations or changing their properties directly, always call redrawAnnotation to rerender the annotation.
Removing annotations
Like with adding annotations, the AnnotationManager provides the deleteAnnotation and deleteAnnotations APIs to delete annotations. You must have a reference to the annotation to use these methods.