Copy link to clipboard
Copied
So I already have some code that I found in these forums that works. Just trying to make it a bit better if possible.
I just want to extract a certain number of pages (in my script below I am extracting the first three) from a batch of PDF's, and have them saved as "Extracted OriginalFileName.pdf". So far so good. So here is that code:
var oldDoc = this;
var newDoc = oldDoc.extractPages(0,2);
newDoc.saveAs(oldDoc.path.replace(oldDoc.documentFileName, "Extracted " + oldDoc.documentFileName));
What I would really like it to do is go through the entire batch without any user interaction. Right now the Javascript editor window pops up and you have to click "Ok" for each document in the batch.
I did some searching, trying to find other simple scripts that behaved the same way, or other extraction scripts that might give me a clue as to what I might need to fix this relatively small issue and I have come up empty.
If someone could point me in the right direction I would appreciate it.
Instead of using the saveAs method you can specify the file-path directly as the third parameter of the extractPages method.
Also, make sure that the "Prompt User" box under the "Execute JavaScript" command in your Action is NOT ticked.
Copy link to clipboard
Copied
Instead of using the saveAs method you can specify the file-path directly as the third parameter of the extractPages method.
Also, make sure that the "Prompt User" box under the "Execute JavaScript" command in your Action is NOT ticked.
Copy link to clipboard
Copied
Wow I feel dumb. I thought I had unchecked that "prompt user" box but I had not. Thank You.
Would using the file path method keep the files from opening as they are created?
Copy link to clipboard
Copied
I think so, yes. If not you can always call the closeDoc method on newDoc...
Find more inspiration, events, and resources on the new Adobe Community
Explore Now