Some test text!

Search
Hamburger Icon

Salesforce / Guides / Remove form fields

Remove PDF form fields

A form field can be removed by deleting its widget annotations. This will remove the ability to interact with the form field since widget annotations represent the appearances of form fields in a PDF document.

Its important to note that a form field can be associated to multiple widget annotations which means there can be multiple interactive appearances and locations in a document for a single form field.

Remove all fields

To remove all form fields in a document, you can remove all widget annotations.

// config.js
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);
});

Remove fields by name

To remove a single field, you can find a field by its name and then delete its widget annotations.

// config.js
const { documentViewer, annotationManager } = instance.Core;

documentViewer.addEventListener('annotationsLoaded', () => {
  const fieldManager = annotationManager.getFieldManager();
  const field = fieldManager.getField('fieldName');
  annotationManager.deleteAnnotations(field.widgets);
});

Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales