Use javascript to handle files created by batch saveAs()?
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.
Any suggestion or hint towards the right direction would be very appreciated. Thank you very much in advance.
