• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Engaged ,
Nov 21, 2019 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

Views

906

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
community guidelines
LEGEND ,
Nov 22, 2019 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?

Votes

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
community guidelines
LEGEND ,
Nov 22, 2019 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.

Votes

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
community guidelines
Community Expert ,
Nov 22, 2019 Nov 22, 2019

Copy link to clipboard

Copied

This code has nothing to do with what you described.

Votes

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
community guidelines
Community Expert ,
Nov 22, 2019 Nov 22, 2019

Copy link to clipboard

Copied

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

Votes

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
community guidelines
Community Expert ,
Nov 22, 2019 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?

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

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
community guidelines
Community Expert ,
Nov 22, 2019 Nov 22, 2019

Copy link to clipboard

Copied

LATEST

See my free abracadabraTools plugin : https://www.abracadabrapdf.net/utilitaires/utilities-in-english/abracadabratools_en/

And its "Deletes all pages without comments" function.

 

I just have to change a "!=" into a "==" in the script to made it "Delete all pages with at least one comment"

Should it be ok for you ?

Votes

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
community guidelines