Remove Form Fields from PDFs Using JavaScript
You can programmatically remove any form field from a document using instance.delete()
. This call will also remove the associated widget annotations. It’s also possible to edit form fields using the built-in user interface.
The following example finds and deletes a form field and its associated widget annotation:
const formFields = await instance.getFormFields(); const formField = formFields.find( (formField) => formField.name === "my form field" ); await instance.delete(formField);