Skip to main content
Inspiring
July 8, 2020
Question

How to remove all the textboxes in my pdf?

  • July 8, 2020
  • 2 replies
  • 3594 views

I want to remove all the text boxes in my PDF but after searching a while, I didn't find any solution. I assume a script is necessary here. I know Python programming, so I assume javascript is just a syntax issue. Could someone provide some ideas about how the script should look like? Thanks!

 

In the document it looks like this on the bottom of every page 

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
July 8, 2020

You can use this code to do it:

 

for (var i=this.numFields-1; i>=0; i--) {
	var f = this.getField(this.getNthFieldName(i));
	if (f==null) continue;
	if (f.type=="text") this.removeField(f.name);
}
Inspiring
July 8, 2020

I got 

SyntaxError: syntax error
1:Console:Exec
undefined

I checked a bit and this.numFields is 0. I think you probably understand the text boxes wrong. The ones I am having in my pdf are the same as the ones when you use the "Add text" tool.

Bernd Alheit
Community Expert
Community Expert
July 8, 2020

Does you use comments?

Can you post a screenshot?

Bernd Alheit
Community Expert
Community Expert
July 8, 2020

Want you remove all form text fields?

Inspiring
July 8, 2020

They are inserted text boxes, the same as one when you want to insert a text on to a page. 

try67
Community Expert
Community Expert
July 8, 2020

There are at least three different ways of doing that, please be more specific about what exact tool you're using to add those "text boxes".