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

javascript to print package repeatedly

cdahl
Registered: Jun 29 2007
Posts: 2

We do large volume printing (photocopying) jobs and I want to figure out how to use the pdf package feature in Acrobat 8.1 professional (Windows) to improve workflow. I want to group documents in a package and then print the series of files so each is separately stapled by the copier but collated as a package (e.g., doc A [stapled], doc B [stapled], doc C [stapled], etc., then repeat doc A [stapled], doc B [stapled], doc C [stapled], etc., etc.)
 
Setting multiple copies in the print dialog collates at the document level (e.g., Doc A, Doc A, Doc B, Doc B, etc.) and I don't want to merge the documents into one because they need to be stapled separately. I am thinking this requires some sort of javascript batch command that would send the package to the printer multiple times in succession (essentially repeating "print all documents" command n number of times). How do I write such a script? Ideally it would present a user dialog to set the number of times the package should be sent to the printer.

My Product Information:
Acrobat Pro 8.0999999999999996447286321199499070644378662109375, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
There is a print command in Acrobat JavaScript and a very rich PrintParams object. To Print a PDF with the default parameters use this code

this.print();

The PrintParams object allows you a great deal of control over printing and not everything in this object is documented.
To modify parameters for printing do this

var myParams = this.getPrintParams();
myParams.NumCopies = 3;
myParams.interactive = 2;
this.print(myParams);

This prints 3 copies. In order to get the print params to work you need to set "interactive" to silent. Otherwise the print dialog will popup with the default parameters and override the settings in the PrintParams object.

Look up the PrintParams object in the Acrobat JavaScript Reference and use this code to discover all those things that are not documented. Run it from the console window.

this.getPrintParams().toSource().split(",").join("\n");

You'll have to make your own dialog for this since you can't use the standard Print dialog. You'll also have to run it from a privileged context (a folder level automation script) since silent operation (suppressing the print dialog) is trusted.

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