PDF Form Script to search pages for a word then list all page no. which doesnot contain that word.

Contributor ,
Nov 21, 2019

Copy link to clipboard

Copied

Want a script to do the following
- Search all pages in a PDF document -
-  Every page should have a certain word or phrase based on user prompt in the Adobe Actions
-   If a page does not have this word or phrase, then print a list of pages that does not have this word or phrase. - want script to this step.
-  this code will be used from Adobe Action Wizard -

 

I have got script to search and mark the word or phrase only want help for doing the last thing, i.e to show the list of pages which doesnot contain the word/phrase searched for.

 

 

 

//HIGHLIGHTING COLOR

var colHilite = color.yellow;
var oDoc = event.target;

var aAnnts = oDoc.getAnnots({sortBy:"Author"});
for(var i=0;i<aAnnts.length;i++)
{
if(aAnnts[i].type == "Redact")
{
aAnnts[i].type = "Highlight";
aAnnts[i].strokeColor = colHilite;
}
}

TOPICS
Acrobat SDK and JavaScript, PDF forms

Views

353

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

PDF Form Script to search pages for a word then list all page no. which doesnot contain that word.

Contributor ,
Nov 21, 2019

Copy link to clipboard

Copied

Want a script to do the following
- Search all pages in a PDF document -
-  Every page should have a certain word or phrase based on user prompt in the Adobe Actions
-   If a page does not have this word or phrase, then print a list of pages that does not have this word or phrase. - want script to this step.
-  this code will be used from Adobe Action Wizard -

 

I have got script to search and mark the word or phrase only want help for doing the last thing, i.e to show the list of pages which doesnot contain the word/phrase searched for.

 

 

 

//HIGHLIGHTING COLOR

var colHilite = color.yellow;
var oDoc = event.target;

var aAnnts = oDoc.getAnnots({sortBy:"Author"});
for(var i=0;i<aAnnts.length;i++)
{
if(aAnnts[i].type == "Redact")
{
aAnnts[i].type = "Highlight";
aAnnts[i].strokeColor = colHilite;
}
}

TOPICS
Acrobat SDK and JavaScript, PDF forms

Views

354

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
Nov 21, 2019 0
Most Valuable Participant ,
Nov 22, 2019

Copy link to clipboard

Copied

Did you get my reply about the method you will need to use at the heart of the code you write, to get each word in turn?

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...
Nov 22, 2019 0
Adobe Community Professional ,
Nov 22, 2019

Copy link to clipboard

Copied

I whould doblbe check your script. It appears to be serching the annotations within a PDF that are of the type "Redact" or redaction annotations and will be removed when Redaction is applied. This is not the same as searching for a word or string within the text of the PDF.

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...
Nov 22, 2019 0
Most Valuable Participant ,
Nov 22, 2019

Copy link to clipboard

Copied

This code has nothing to do with what you described.

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...
Nov 22, 2019 0
Adobe Community Professional ,
Nov 22, 2019

Copy link to clipboard

Copied

You can check every page with the parameter nPage of the method getAnnots.

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...
Nov 22, 2019 0
Adobe Community Professional ,
Nov 22, 2019

Copy link to clipboard

Copied

Do you want the words to be highlighted?

So it looks like you have a 2 step process.

1) run a redaction search.

2) run a script to figure out which pages don't have the searched words.

 

Did you do this as an Action?  This is the best way to do it.

So the script for #2 is tricky. 

One way to do this is to use the annotation list to create a sorted list of  page numbers onwhich the annots appear.

Then walk this list to create a list of numbers that do not appear in the first list.

 

Do you have any programming experience?

 

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...
Nov 22, 2019 0