Skip to main content
Participant
August 7, 2020
Answered

How to mass remove specific text areas using batch processing?

I need to remove two text areas from A LOT of pdf files.
I am using batch processing with this script:


var fields = new Array();
for ( var i=0; i<this.numFields; i++)
{
var fname = this.getNthFieldName(i);
if ( this.getField(fname).type == "text" )
{
fields.push(fname);
}
}


for (var i=0; i<fields.length; i++)
{
this.removeField(fields[i]);
}


My problem is that it removes all text areas.
I do not know where to put the value so that it would only
remove two specific text areas.
One has a value Directions and the other one Directions2

Would you please help me?

This topic is closed to new replies. Start a new post to keep the conversation going.
bebarth
bebarthCorrect answer
Community Expert
August 7, 2020

Hi,

you must write:

if ( this.getField(fname).type == "text" && this.getField(fname).value=="searchedText")...

@+

4 replies

Bernd Alheit
Community Expert
Community Expert
August 7, 2020

You must check the value of the fields.

Translate
Participant
August 7, 2020

Hi! Could you let me know where can I put the value? I have no idea where to add it. THanks!

Translate
bebarth
Community Expert
bebarthCommunity ExpertCorrect answer
Community Expert
August 7, 2020

Hi,

you must write:

if ( this.getField(fname).type == "text" && this.getField(fname).value=="searchedText")...

@+

Translate