3 Replies Latest reply on Mar 12, 2012 11:15 AM by try67

    Using printerName in Javascript

    Davi A

      I am trying to use the "printerName:" command in Javascript. Here is what i have to work with..

       

      /* Print 1st Page */

      /* This sequence prints the first page of

      each document selected to the default printer.

      */

      printParams: {

          printerName = "100C_01C155_HP4250"

      }

      this.print

      ({

      bUI: false,

      nStart: 0,

      bSilent: true,

      bShrinkToFit: true,

      });

       

       

      This will only print to the print queue that was last selected. I want it only utlize the printer specified. I also trying to make a print whole document to "said printer" script, instead of just first page to "said printer".

       

      Thanks in advance.

      Davi A

        • 1. Re: Using printerName in Javascript
          try67 MVP & Adobe Community Professional

          You have to specify the printParams parameter in the print() method, and

          provide to it the object you've created.

          Be aware that when doing so, all the other parameters are ignored.

          1 person found this helpful
          • 2. Re: Using printerName in Javascript
            Davi A Level 1

            I am still not clear on what I should do.   Truthfully this is my first go at writing java.

             

            I made a change but still same result...

             

             

            /* Print 1st Page */

            /* This sequence prints the first page of

            each document selected to the default printer.

            */

            this.print

            ({

            bUI: false,

            nStart: 0,

            bSilent: true,

            bShrinkToFit: true,

            printParams: {

            printerName: "Office Printer 1"

            }

            });

             

            would "printParams" need to include "fileName ="? If so is there another way of going about it? also would i need to get rid of all the other parameters, that tell it to print what pages?

            • 3. Re: Using printerName in Javascript
              try67 MVP & Adobe Community Professional

              Here's the most basic way of using the PrintParams:

               

              var pp = this.getPrintParams();

              pp.printerName = "Office Printer 1";

              this.print(pp);

               

              You need to read up on the various possible options the PrintParams object

              offers in the Acrobat JavaScript API Reference.

              1 person found this helpful