Some test text!
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.
To remove all form fields in a document, you can remove all widget annotations.
WebViewer(...)
.then(instance => {
const { docViewer, annotManager, Annotations } = instance;
docViewer.on('annotationsLoaded', () => {
const annots = annotManager.getAnnotationsList();
// find the widget annotations
const widgetAnnots = annots.filter(a => a instanceof Annotations.WidgetAnnotation)
// remove the widget annotations
annotManager.deleteAnnotations(widgetAnnots);
});
});
To remove a single field, you can find a field by its name and then delete its widget annotations.
WebViewer(...)
.then(instance => {
const { docViewer, annotManager } = instance;
docViewer.on('annotationsLoaded', () => {
const fieldManager = annotManager.getFieldManager();
const field = fieldManager.getField('fieldName');
annotManager.deleteAnnotations(field.widgets);
});
});
Get the answers you need: Support
Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.
Select a platform to get started with your free trial.
Web
Android
iOS
Windows
Linux
Unlimited usage. No email address required.