Disable input fields from PDF in the WebViewer

WebViewer Version:
8.3

Can you reproduce using one of our samples or online demos?
Yes.

Are you using the WebViewer server?
No.

Does the issue only happen on certain browsers?
No.

Is your issue related to a front-end framework?
Yes.

Is your issue related to annotations?
No.

Please give a brief summary of your issue:
How to disable input fields in a PDF file rendered in the WebViewer

Please describe your issue and provide steps to reproduce it:
I have a PDF document which includes some fillable inputs, (text fields, checkboxes, dropdowns, etc)
I would like to disable these inputs when the PDF is shown in the WebViewer. Is this possible?

Thank you very much for the help.

Hi Gabor,

Are the inputs created from WebViewer or are they part of the PDF. If they’re part of the PDF can you attach the PDF so I can test it out?

Thanks!
Will

Hi Will, thanks for answering.
The inputs are part of the PDF.
I’ve attached an example.
pdf_with_inputs.pdf (460.0 KB)

Thanks.

Hi Will,

Any news on this issue? Did you find the time to give it a try?
Thanks a lot.

Gabor

Hi Gabor,

How are you loading this PDF? I get this issue when trying to load

Hi Will,

Thanks for checking it out. We are doing some processing on the original pdf, and that’s what we load in the WebViewer.
The document I’m attaching now should work in the WebViewer.

Thanks,
Gabor

pdf_with_forms.pdf (275.4 KB)

Hi Gabor,

After testing, you can use this code snippet to remove these unwanted inputs.

const { documentViewer, annotationManager, Annotations } = instance.Core;

    documentViewer.addEventListener('annotationsLoaded', () => {
      const annots = annotationManager.getAnnotationsList();

      // find the widget annotations
      const widgetAnnots = annots.filter(a => a instanceof Annotations.WidgetAnnotation)

      // remove the widget annotations
      annotationManager.deleteAnnotations(widgetAnnots);
    });

See: Apryse Documentation | Documentation for more information

Cheers!
Will