• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to create a button with predefined print settings?

New Here ,
Aug 18, 2022 Aug 18, 2022

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

TOPICS
Print , Windows

Views

603

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 18, 2022 Aug 18, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 19, 2022 Aug 19, 2022

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

 

Robert25705650jnqf_0-1660906194658.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 19, 2022 Aug 19, 2022

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 19, 2022 Aug 19, 2022

Copy link to clipboard

Copied

(mistake)    ... NOT described in API. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2022 Aug 19, 2022

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines