How can I help you?
Remove PDF form fields from a PDF
16 Feb 20261 minute to read
Remove form fields using the UI
Steps:
- Enable Form Designer mode.
- Select the form field.
- Click Delete in the toolbar or press the Delete key.
Remove form fields programmatically
Use deleteFormField() with a field reference or ID
<button id="deleteAllFields">Delete Form Fields</button>
<button id="deleteById">Delete First Field By ID</button>// Delete all added form fields on button click
(document.getElementById('deleteAllFields') as HTMLButtonElement).addEventListener('click', () => {
const fields = [...pdfviewer.formFieldCollections]; // clone to avoid mutation issues
fields.forEach(field => pdfviewer.formDesignerModule.deleteFormField(field));
});
// Delete by ID on button click (example uses the first field's ID)
(document.getElementById('deleteById') as HTMLButtonElement).addEventListener('click', () => {
if (pdfviewer.formFieldCollections.length > 0) {
const id = pdfviewer.formFieldCollections[0].id;
if (id) {
pdfviewer.formDesignerModule.deleteFormField(id);
}
}
});