These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Batch Process Save as Adobe PDF

cokemachine
Registered: Jan 6 2011
Posts: 3
Answered

I have several PDFs with digital signatures that I will be merging with several other PDFs to send to a customer for invoiving. Given that the digital signatures will be removed when merging the documents, I need to create a batch script to reprint each of the selected PDFs using the Adobe PDF printer.
 
I'm unsure as to how to switch to the Adoboe PDF printer and then overwite each file with the same file name. I'm using Acrobat Pro 9.4.0. Can anybody help out with a script to do this type of batch process?

Cokemachine

My Product Information:
Acrobat Pro 9.4, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
So, you want to flatten the signed PDFs? How about just combining them as embedded files, or a portfolio so that they retain thier signatures, but can be treated as a single file?

But if you really want to over write them then you can use a simple print script. All the print drivers can be found in the "app.printerNames" property. Look up the "doc.print" function in the JavaScript Reference.

Here's an example:

var pp = this.getPrintParams();
pp.printerName = "Adobe PDF";
pp.interactive = pp.constants.interactionLevel.silent;
this.print(pp);

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

cokemachine
Registered: Jan 6 2011
Posts: 3
That code works, but the problem I now run into is that I cannot overwrite the existing files without the Save As dialog box opening for each file. I have to either save the processed files in a different folder or save the files with a different name. Is there a way to bypass the Save As dialog box as that would be my ideal solution?

I can set the Adobe PDF printer properties to save the processed files to the same specific folder as a work around right now. Is it possible to create a "Processed" folder in the same path as the existing files?

Cokemachine

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Accepted Answer
Hmm, there is a way to do this but its not pretty. Look in the Acrobat JavaScript Reference at the doc.print function. One of the examples shows how to print to postscript. So, print the file to post script then open it into Acrobat( with app.openDoc), which converts it back to PDF. Now the file can be written out as PDF using the doc.saveAs fucntion. Make sure the batch process is to to Not Save the File. I've used this methodology before, in automation script, not sure how it will work in a batch process.

This process would be a lot easier if the files were not digitally signed. If that were the case you could simply flatten the file with the doc.flattenPages function.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

cokemachine
Registered: Jan 6 2011
Posts: 3
Thanx for the responses Thom. Yes, digital signature are a blessing in some respects, but a curse in others. It's too bad that Adobe closed the security hole in Acrobat 9, because the doc.flattenPages function was what I used to use before upgrading.

Cokemachine