Copy link to clipboard
Copied
I have a folder of 1000 documents and I would like to Enhance (and Recognize Text and Optimize) only the first 10 pages of them all for now (I simply want to make the Title page, copyright, table of contents etc... searchable). I know you can do this manually by setting the page range in the main tool, but I'm hoping that there is a JavaScript command for it to be done automatically.
Here's one I found for extracting pages, but I don't know what to change in order to make it work for Enhance/OCR
var filename = this.path;this.extractPages({nStart:8, nEnd:9, cPath:filename+"_abstract.pdf"});
Copy link to clipboard
Copied
Not possible with JavaScript.
Copy link to clipboard
Copied
I find that surprising, but thank you. Do you know of any way to do this, or at least get close to it? It seems there must be a way
Copy link to clipboard
Copied
Try using an Action, via Tools - Action Wizard.
Copy link to clipboard
Copied
I don't think it is possible there, which is why I was looking into Javascript. Doesn't Action Wizard write Javascript code behind the scenes anyway?
Copy link to clipboard
Copied
No. It can execute JS code but not all that can be done in an Action can be done in a script.
Copy link to clipboard
Copied
Thanks for clarifying.
It really does seem that it should be possible to do a batch optimize action on a specific page or page ranges, as you can with the specific tools. Extract 1st page(s) of all documents seems possible with the sample Javascript code I posted, for example.
Copy link to clipboard
Copied
You can do it in steps:
Action 1: Extract the pages you wish to process as new files
Action 2: Optimize those files
Action 3: Insert those files back into the originals
However, you will have to manually run each Action on its own.
Copy link to clipboard
Copied
Thanks, that seems feasible for me. I can probably figure out the first two, but I'm not sure how to do the 3rd - how would you set it to align the extracted and optimized files with the ones they came from? Would each pair need to be in their own folder?
Copy link to clipboard
Copied
Not necessarily, but you would need to know where they are located and how they are named.
So if in Action 1 you extract the pages as <Original file name>_extracted.pdf then in Action 3 you would need to look for those extracted files and insert them into the original PDF. It's better if they are in the same folder, but then you would need to add a condition to your code to ignore files that end with "_extracted", as they will also be processed by the Action.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now