Copy link to clipboard
Copied
In the 2020 version of Acrobat DC, is there a way to automate deleting all form fields in the PDF? I looked at Action Wizard and it doesn't look like you can use it to do this. I can't write JavaScript. Here is how I manually do this for each PDF.
I would like to repeat this process for an entire folder of files. (I am deleting "buttons" that use the form field to perform an action. If I use Redact > Remove Hidden Information and select "Form fields" and then execute, it deletes the field's entry from the PDF but leaves behind the button. When I perform the above procedure it deletes both the field and the button.)
Any help will be appreciated!
Have your Action execute the following JavaScript code:
for (var i=this.numFields-1; i>=0; i--) {
var f = this.getField(this.getNthFieldName(i));
if (f==null) continue;
this.removeField(f.name);
}
Copy link to clipboard
Copied
Have your Action execute the following JavaScript code:
for (var i=this.numFields-1; i>=0; i--) {
var f = this.getField(this.getNthFieldName(i));
if (f==null) continue;
this.removeField(f.name);
}
Copy link to clipboard
Copied
Thank you so much! This will save me time.
I realize that this might be too much work but if it is not, I'd also like to know how to delete fields that start with the same name. For example, Search1, Search2, Search3...
Copy link to clipboard
Copied
Change this line:
this.removeField(f.name);
To:
if (/^Search/.test(f.name)) this.removeField(f.name);
This will remove all fields whose name starts with "Search".