Skip to main content
New Participant
August 18, 2022
Question

How to create a button with predefined print settings?

  • August 18, 2022
  • 1 reply
  • 1343 views

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

This topic has been closed for replies.

1 reply

try67
Adobe Expert
August 18, 2022

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.

Robert-77Author
New Participant
August 19, 2022

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)?

 

 

Robert-77Author
New Participant
August 19, 2022

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?