3 Replies Latest reply on Dec 25, 2017 11:01 PM by Yves Willemaers

    Setting PrinterName doesn't really preselect the printer in the print dialog box

    Yves Willemaers

      I have 2 printers. One is specially bought for shipping labels.

      All my shipping labels are generated pdf files with smaller dimensions (153,8 x 106,2 mm, let's say A6 format).

      As I use the other printer on the same machine (iMac) for all "normal" A4 pdf documents, I always have to be careful not to waste shipping labels, using Acrobat Reader DC taking into account the last chosen printer will be preselected in the print dialog box. This, of course, is the normal behavior of Acrobat Reader.


      My Acrobat Reader DC:

      Architecture: x86_64

      Build: 18.9.20050.254034

      AGM: 4.30.72

      CoolType: 5.14.5



      My iMac:

      OS X El Capitan version 10.11.6



      The next script normally should launch the print dialog box with the best printer preselected (in function of the paper size).

      • the printers on my iMac are known as "DYMO LabelWriter 4XL" (for the shipping labels) and "Brother HL-L2360D series" (for A4 documents).
      • from the moment the document has smaller dimensions (< 160 x 108 mm), the Dymo label printer must be chosen.
      • In the acrobat Reader DC program I enabled "Acrobat JavaScript", "Enable menu items JavaScript execution privileges" and "Show console on errors and messages".
      • the app.alert at the end is an extra feedback during the tetst and shows me the name of the chosen printer just before launching the print dialog box.


      // start script


      var defaultPrinter = (new String("DYMO LabelWriter 4XL"));

      var largeFormatPrinter = (new String("Brother HL-L2360D series"));

      var pageBox = this.getPageBox();

      var pageWidth = pageBox[2]/2.83;

      var pageHeight = pageBox[1]/2.83;

      var selectedPrinterName;


      if (pageWidth<160 && pageHeight<108) {

        selectedPrinterName = ""+defaultPrinter;


      else {

        selectedPrinterName = ""+largeFormatPrinter;


      var pp = this.getPrintParams();

      pp.printerName = selectedPrinterName;

      app.alert("The chosen printer is " + pp.printerName, 3);



      // end script


      Problem: Even if the correct printer is displayed in the alert (defined by the page dimensions), the preselected printer in the print dialog box is not always the right printer. It still will be the last used one: the normal behavior of Acrobat Reader. Somebody told me it was really working on his Windows machine. Is there something I'll have to configure in the Acrobat Reader program preferences or something else I'll have to take into account on a iMac machine?