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

JavaScript slently print HELP

New Here ,
Aug 20, 2017 Aug 20, 2017

Copy link to clipboard

Copied

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

TOPICS
Acrobat SDK and JavaScript

Views

294

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 21, 2017 Aug 21, 2017

Copy link to clipboard

Copied

From what context are you executing this code?

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 21, 2017 Aug 21, 2017

Copy link to clipboard

Copied

LATEST

Folders are executed.

The file is generated .JS file, added to the custom menu, the code can be executed correctly but not the result I want.

This is the beginning of the code.

app.addMenuItem({   

  cName: "Number", cParent: "Tools",

  cExec: "AutoNumber();",

  cEnable: "event.rc= (event.target != null);" });

function AutoNumber()

{

}

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