Remove Form Fields from PDFs Using JavaScript

You can easily remove any form field from a document using instance.delete(). This call will also remove the associated widget annotations.

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);

Please see the Updating and Removing Annotations section of the Introduction to Annotations guide to learn more about removing annotations.

We use cookies to improve your experience and for marketing. Learn more in our privacy policy.