Property 'widgets' does not exist on type 'WidgetAnnotation'

I am getting the error while trying to make a filed ReadOnly:
Property ‘widgets’ does not exist on type ‘WidgetAnnotation’

using the following code:

const field = fieldManager.getField('fieldName');
 => {
            annot.fieldFlags.set('ReadOnly', true);

Hi @mahade.hasan,

I am not able to reproduce this error, but I have a couple of sugggestions:

  • Are you certain there is a widget attached to the field?
  • Instead of setting the flag on the widget itself, you can instead set the flag on the field. For example:
    field.flags.set('ReadOnly', false)

If this does not work, please share a complete snippet of how you are creating fields/widgets, or a document where you are seeing this problem.

Best Regards,
Armando Bollain
Software Developer
PDFTron Systems, Inc.

1 Like
field.flags.set('ReadOnly', false)

This did the work I was trying to do. Thanks.