2 Replies Latest reply on Aug 21, 2017 4:37 AM by alex520

    JavaScript slently print HELP

    alex520

      JavaScript slently print HELP

      Translate google

      I have 2 printers, print PDF file size is 430mm * 310mm, and need to be marked with 0001-00100 each number, you can manually double-sided printing on the 450mm * 320mm, but I and JavaScript silently print, only print Double sided A4 size paper. Plus "pp.flags | = fv.setPageSize;" can print out the A3 size red, but not the first time to print the parameters to print correctly. That is, the last print setting parameter is not recorded when silently printing.

      The code is as follows:

       

      var l= 4;

      var s = 5;

      var p=0;

      for(var i = 1; i <= s;i++) {

        this.getField("Text1").value=pad(i,l);

        this.print({bUI: false, bSilent: false, bShrinkToFit: false});

                                            }

       

       

      function pad(num, n) { 

          var len = num.toString().length; 

          while(len < n) { 

              num = "0" + num; 

              len++; 

                                  } 

          return num; 

                                          }

       

       

       

       

      The following is another code is also printed without the correct results.

       

       

         var pp = this.getPrintParams();

         pp.interactive = pp.constants.interactionLevel.silent;

         pp.pageHandling = pp.constants.handling.none;

         var fv = pp.constants.flagValues;

         pp.flags |= fv.setPageSize;

         this.print(pp);