Some test text!

Form Field Indicators

Adding form field indicators

The following code adds indicator text to all the form fields after the annotationsLoaded promise has resolved.

Note this feature is for WebViewer 8.9+
.then(instance => {
  const { documentViewer, annotationManager, Annotations } = instance.Core;

  const addIndicator = (widget) => {
    widget.setFieldIndicator(true, 'Insert text here');

  documentViewer.addEventListener('annotationsLoaded', () => {
    const widgetAnnotations = annotationManager.getAnnotationsList().filter(annotation => annotation instanceof Annotations.WidgetAnnotation);

    annotationManager.trigger('annotationChanged', [widgetAnnotations, 'modify', {}]);
Note the annotationChanged event is triggered afterwards so that the indicators update after the changes to the fields' widgets are made

Toggle form field indicators

You can choose to hide form field indicators when they would normally be shown using the hideFormFieldIndicators API.

Likewise, you can also choose to show form field indicators if they have been hidden using the showFormFieldIndicators API.

Set form field indicators programatically

You can choose to hide form field indicators when they would normally be shown or show them when they are hidden, and change the text that they contain using the setFieldIndicator API.

Get the answers you need: Support

Upcoming Webinar: PDFTron SDK Tech Review | Nov 29, 2022 at 2 pm ET


The Platform


© 2022 PDFTron Systems Inc. All rights reserved.


Terms of Use