Copy link to clipboard
Copied
Hi,
I have succesfully written a script which uses a dynamic stamp to set an "Exhibit 1, 2, 3..." stamp on single PDFs based on the filename (the source files are labeled 001-..., 002-..., etc.). The script uses saveAs() to save the newly stamped files with names P001-....pdf, P002-...pdf in the same folder than the source.
I can now run an action which runs the script on multiple files.
What I need to do next in the workflow is combine all the newly created, stamped files in a single (optimised) PDF file, which I do manually from Windows Explorer (select - right click - combine, option "reduce file size"). The fact of having a bookmark corresponding to each file is a plus.
I would like to further automate this as part of my action (or of a folder level script).
Leaving aside the optimisation question (which I understand I could solve by using doc.preflight), I don't understand how I am supposed to use, from the same script or action, the files I have generated in order to combine them. I went through the Acrobat Javascript reference and don't find anything clearly useful (storing the newly created filenames/paths as global variables and use insertPages afterwards? have all the newly created files open in Acrobat and use the activeDocs property in conjunction with insertPages?).
The obvious problem I encounter is that the script executed through the action runs on every single file sequentially whereas I need part of the automation to be ran on each file before getting to the next step of combining the results.
So the process is:
I have files 001-file1.pdf, 002-secondexample.pdf, 003-thirdfile.pdf.
The existing script yields P001-file1.pdf, P002-secondexample.pdf, P003-thirdfile.pdf.
Copy link to clipboard
Copied
Any hint or idea, or the definite conclusion that it is impossible, would be greatly appreciated... thank you in advance!
Copy link to clipboard
Copied
So you want to combine all the files in the folder? If so, it can be done using a combination of an Action (which collects the file paths) and a script which combines them.
In fact, I've developed a (paid-for) tool that does just that. You can find it here: Custom-made Adobe Scripts: Acrobat -- Batch Combine All PDF Files in a Folder
Copy link to clipboard
Copied
Thank you, this seems to be a useful piece of the puzzle, but if I understand correctly the script does not touch the content of the files prior to combining them. I am looking for a solution to execute a script on each file (which changes its contents) prior to combining them, and to have this process included in a single action/script/command. Does it seem feasible?
Copy link to clipboard
Copied
You can change the Action to make the edits you need, but it still has to be a two-step process.