Customize field styles in Typescript

WebViewer Version: 8.0.0

Please give a brief summary of your issue:
Unable to access WidgetAnnotation class and functions; code sample returns ‘typeof’ class instead of instance
Howdy,

We’re very new to PDFTron. Currently trying to apply styling to form fields, working from these support articles;

We’re working in Typescript, rather than pure JS.

When we try replicate the code from the samples, the ‘getCustomStyles’ and ‘getContainerCustomStyles’ functions aren’t recognised when we call it them on Annotations.WidgetAnnotation. It seems that this is returning ‘typeof WidgetAnnotation’, rather than an actual instance of the class.

Anyone able to offer any pointers?

Thanks in advance!

Hi there
Have you had a chance to review this sample demo https://www.pdftron.com/documentation/web/samples/forms/#customizing-form-fields there is a code sample and live code.

I have, yes - it was linked from one of the articles I posted in the original question.

I’ve worked around the issue by bypassing the Typescript type-checking when access the relevent properties; e.g.;

Annotations.WidgetAnnotation['getCustomStyles']

That’s done the job for now!