Skip to main content
Participating Frequently
April 3, 2021
해결됨

Batch process to check hundreds of pdfs to see if they are not "image-only" PDFs

  • April 3, 2021
  • 1 답변
  • 3525 조회

How can I check all pdfs in several directories/folders to ensure that they are not just "scanned or image-only" pdfs and if any are found, create a report (html file or a text file) with the results.

I understand how to do this with the pdf that I open in Adobe DC but no idea how to do this with actions/scripting etc.

이 주제는 답변이 닫혔습니다.
최고의 답변: try67

You can do it using JavaScript by counting the number of words in the file. If it's zero, it means it hasn't been OCRed.

The easiest way to output these results is to the JS Console, which you can then open at the end of the process to see the names of the files that were detected.

You can do that by having your Action execute this code:

 

var totalNumWords = 0;
for (var p=0; p<this.numPages; p++) {
	var numWords = this.getPageNumWords(p);
	totalNumWords+=numWords;
	if (totalNumWords>0) break;
}
if (totalNumWords==0) console.println(this.path);

1 답변

try67
Community Expert
try67Community Expert답변
Community Expert
April 3, 2021

You can do it using JavaScript by counting the number of words in the file. If it's zero, it means it hasn't been OCRed.

The easiest way to output these results is to the JS Console, which you can then open at the end of the process to see the names of the files that were detected.

You can do that by having your Action execute this code:

 

var totalNumWords = 0;
for (var p=0; p<this.numPages; p++) {
	var numWords = this.getPageNumWords(p);
	totalNumWords+=numWords;
	if (totalNumWords>0) break;
}
if (totalNumWords==0) console.println(this.path);
Jerry5EFC작성자
Participating Frequently
April 3, 2021

Thank you.....I guess what I am trying to do can be done, now just need to understand how to actually do it with the information you provided (never created an action before or even used javascript in Adobe DC).

 

Is there anyplace that would explain (sort of a step by step) how to do something like you recommended?

 

BTW - thank you for replying.

Jerry5EFC작성자
Participating Frequently
April 3, 2021

Thanks for all the info and for the heads-up about any non-pdf files being automatically converted to pdf.


Not sure how to do an edit on above - just wanted to add that when I pick the pdfs via adding files, I can do a search for *.pdf and then add then (solution to not worrying about other files types). This seems to work also.