Copy link to clipboard
Copied
I often use 2 print settings:
a) size, fit, portrait
b) multiple, 2 by 1, landscape, both sides, turn along short edge
Changing these two options requires at least 2 or 4 clicks after enetering the print dialog. So it is up to 6 clicks (one for the dialog and one for the final Print button) before the printer actually starts printing.
Is there a way to create various custom buttons for quick printing without any additional dialogs each having all the predefined parameters from the print dialog (printer, pages to print, page sizing & handling, orientaition, both sides YES/NO...)?
Robert
Copy link to clipboard
Copied
Yes, it's possible, to an extent, but if you want the script to print the file without any user-confirmation at all it has to run from a privileged context, which usually means installing a script file on the local machine of each user who's going to be using it.
You should read the documentation of the print method (of the Document object) and the PrintParams object for more details on this subject.
Copy link to clipboard
Copied
Thanks. I later came across your javascripts (great help!) and started tweaking them using the API reference. I almost achieved what I need. The only missing property I cannot find anywhere is the main paper orientation Portrait/Landscape. Here is the core of my script:
pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.silent;
pp.interactive = pp.constants.interactionLevel.automatic;
pp.pageHandling = pp.constants.handling.nUp;
pp.nUpPageOrders = pp.constants.nUpPageOrders.Vertical;
pp.nUpNumPagesH = 2;
pp.nUpNumPagesV = 1;
pp.nUpAutoRotate=true;
pp.DuplexType = pp.constants.duplexTypes.DuplexFlipShortEdge;
pp.printerName = "Bullzip PDF Printer";
this.print(pp);
The results is in portrait orientation by default. Do you know how to switch from Portrait do Landscape (green ellipse in the pic)?
Copy link to clipboard
Copied
I also tried to switch these parameters
pp.nUpNumPagesH = 1;
pp.nUpNumPagesV = 2;
but then I have to either "View" > "Rotate view" > "Clockwise" (no API function again? I tried various combinations of
app.execMenuItem("Clockwise");
but no success) or to create a general function to change the page order as "2,1,4,3,..."
In the dialog I can simply choose "Pages per sheet" to be 2 in the dropdown menu (and the result looks good too) but again this is described in API. API always has both the parameters above. What is the trick?
Copy link to clipboard
Copied
(mistake) ... NOT described in API.
Copy link to clipboard
Copied
Unfortunately, not everything that you can do in the Print dialog can be scripted... This seems to be one of those parameters that can't be. You can rotate the pages themselves, using the setPageRotations method, but that won't work if the file is used in Reader.