Custom Annotations.HTMLAnnotation

This question has been asked 2 years ago.

We need the ability to “tag” documents with placeholder annotations (custom annotation classes), export them as xfdf, and them load them back into webviewer where they will be instantiated back into custom annotation instances.

We have many custom tag annotations which all look different and have different behavior. Currently they all extend stamp annotation where the annotation is drawn using the canvas context.

Drawbacks to using stamp is

  1. Enlarging the annotation introduces blurriness because it is an image
  2. Changing the appearance of the annotation or adding a new one is difficult because it must be drawn onto the canvas context programmatically.

How can we use HTMLAnnotation to create custom annotations?

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:


Have you had a chance to review this guide on how to create custom annotations?

Yes. But this example is limited in that it only demonstrates extending from CustomAnnotation class. What if we want to extend FreeTextAnnotation but have it be also be a CustomAnnotation that can be serialized and deserialized by to its appropriate custom annotation class instance?

This functionality is provided by

instance.Annotations.CustomAnnotation.createFromClass(string, AnnotationCtor)

but we are using v7 of webviewer-ui.