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");
if (!formField) { console.warn('Form field "my form field" not found'); return;}
await instance.delete(formField);Try this example in our Playground(opens in a new tab).