Create Custom Annotation with Angular and TypeSript

Product:

Product Version:
@pdftron/webviewer": “^8.3.0”,
Please give a brief summary of your issue:
I copied the code to create a custom Annotation from the documentation.

Error when trying to register a custom annotation.

Please describe your issue and provide steps to reproduce it:

Please provide a link to a minimal sample where the issue is reproducible:

Hello @shatal1,

This is an issue with the types file for the Annotation Manager not working correctly with custom annotations. However, the code does work. All you need to do is suppress the type error with the tag: // @ts-ignore

Example:

// this is necessary to set the elementName before instantiation
      TriangleAnnotation.prototype.elementName = "triangle";
      annotationManager.registerAnnotationType(
        TriangleAnnotation.prototype.elementName,
        // @ts-ignore
        TriangleAnnotation
      );

Best Regards,

Armando Bollain
Software Developer
PDFTron Systems, Inc.
www.pdftron.com

1 Like