Highlighted

How to mass remove specific text areas using batch processing?

New Here ,
Aug 07, 2020

Copy link to clipboard

Copied

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?

Hi,

you must write:

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

@+

TOPICS
Acrobat SDK and JavaScript, Create PDFs, How to, PDF forms

Views

71

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to mass remove specific text areas using batch processing?

New Here ,
Aug 07, 2020

Copy link to clipboard

Copied

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?

Hi,

you must write:

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

@+

TOPICS
Acrobat SDK and JavaScript, Create PDFs, How to, PDF forms

Views

72

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 07, 2020 0
Adobe Community Professional ,
Aug 07, 2020

Copy link to clipboard

Copied

You must check the value of the fields.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 07, 2020 0
New Here ,
Aug 07, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 07, 2020 0
Participant ,
Aug 07, 2020

Copy link to clipboard

Copied

Hi,

you must write:

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

@+

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 07, 2020 0
New Here ,
Aug 07, 2020

Copy link to clipboard

Copied

Thank you!!!

This worked. You have saved me a lot of work.

 

 

Here's the code:

 

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


for (var i=0; i<fields.length; i++)
{this.removeField(fname).type == "text";
}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 07, 2020 0