JavaScript slently print HELP

New Here ,
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

101

Likes

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

JavaScript slently print HELP

New Here ,
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

102

Likes

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
Aug 20, 2017 0
Most Valuable Participant ,
Aug 21, 2017

Copy link to clipboard

Copied

From what context are you executing this code?

Likes

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
Reply
Loading...
Aug 21, 2017 0
alex520 LATEST
New Here ,
Aug 21, 2017

Copy link to clipboard

Copied

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

{

}

Likes

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
Reply
Loading...
Aug 21, 2017 0