Highlighted

Print Dialog Presets - Change Default DuplexMode attribute

Community Beginner ,
Jul 15, 2020

Copy link to clipboard

Copied

Hi there,

How can I change default value of DuplexMode property in Print Dialog Presets to 'Duplex Flip Long Edge'? I need every new PDF file to be created with duplex mode by default. Any suggestions?

 

Or is it possible to achieve this programatically, say using JavaScript etc.?

Adobe Community Professional
Correct answer by ls_rbls | Adobe Community Professional

Sure !

 

Below is a script that I was able to figure out to help another user. 

 

I started learning JavaScript in January 2020 (still learning), and in about a month and a half I was able to come up with this: 

 

 

 

app.alert("Document is now Printing");

var pp2 = this.getPrintParams();
pp2.firstPage = 2;
pp2.lastPage = 6;
pp2.interactive = pp2.constants.interactionLevel.automatic;
pp2.DuplexType = pp2.constants.duplexTypes.DuplexFlipLongEdge;
pp2.pageHandling = pp2.constants.handling.fit;
pp2.printerName = "";
if (this.getField("CH.2").value == "Yes") {this.print(pp2)};

var p2 = app.thermometer; 
p2.duration = this.print(pp2);
p2.begin();
for ( var i = 0; i < this.print(pp2); i++)
{
p2.value = i;
p2.text = "Printing pages 3-5"; break; 
}
p2.end(); 


var pp4 = this.getPrintParams();
pp4.firstPage = 9;
pp4.lastPage = 9;
pp4.interactive = pp4.constants.interactionLevel.automatic;
pp4.DuplexType = pp4.constants.duplexTypes.simplex;
pp4.pageHandling = pp4.constants.handling.fit;
pp4.printerName = "";
if (this.getField("CH.4").value == "Yes") {this.print(pp4)};

var p4 = app.thermometer; 
p4.duration = this.print(pp2);
p4.begin();
for ( var i = 0; i < this.print(pp4); i++)
{
p4.value = i;
p4.text = "Printing page 8"; break; 
}
p4.end();


var pp6 = this.getPrintParams();
pp6.firstPage = 11;
pp6.lastPage = 16;
pp6.interactive = pp6.constants.interactionLevel.automatic;
pp6.DuplexType = pp6.constants.duplexTypes.DuplexFlipLongEdge;
pp6.pageHandling = pp6.constants.handling.fit;
pp6.printerName = "";
if (this.getField("CH.6").value == "Yes") {this.print(pp6)};

var p6 = app.thermometer; 
p6.duration = this.print(pp6);
p6.begin();
for ( var i = 0; i < this.print(pp6); i++)
{
p6.value = i;
p6.text = "Printing pages 10-15"; break; 
}
p6.end();


var pp8 = this.getPrintParams();
pp8.firstPage = 17;
pp8.lastPage = 17;
pp8.interactive = pp8.constants.interactionLevel.automatic;
pp8.DuplexType = pp8.constants.duplexTypes.simplex;
pp8.pageHandling = pp8.constants.handling.fit;
pp8.printerName = "";
if (this.getField("CH.8").value == "Yes") {this.print(pp8)};

var p8 = app.thermometer; 
p8.duration = this.print(pp8);
p8.begin();
for ( var i = 0; i < this.print(pp8); i++)
{
p8.value = i;
p8.text = "Printing page 16"; break; 
}
p8.end();


var pp9 = this.getPrintParams();
pp9.printRange=[[22,22]]
pp9.printRange.push([23,24]);
pp9.interactive = pp9.constants.interactionLevel.silent;
pp9.pageHandling = pp9.constants.handling.fit;
pp9.printerName = "";
this.print(pp9);

var p9 = app.thermometer; 
p9.duration = this.print(pp9);
p9.begin();
for ( var i = 0; i < this.print(pp9); i++)
{
p9.value = i;
p9.text = "Printing pages 21-23"; break; 
}
p9.end();

 

 

 

 

You can use the original discussion as a reference  here (back in 17 February 20202):    Print based on boxes checked 

 

And there are plenty of excellent tutorials and discussions here in the forums that you can search and find useful.

 

But everything you need to know about the  getPrintParams method   is very clearly explained with examples in the following guidance:

 

 

So with some reading it is really not that complicated. It could get really complicated though. 

 

Be aware that the reference above is almost 800 pages long, so happy reading!

 

NOTE:

In my personal opinion, I did all the work for that other user and the individual never marked my solution as correct answer; that kind of hurt my "Adobe" wannabe..neverwas... Alter-ego ... specially after so much effort. 

 

But anyway, there's an old Japanese proverb that one old teacher shared with me when I was younger:

 

"Empty yourself completely to be filled up abundantly"

TOPICS
Acrobat SDK and JavaScript, Create PDFs, Print and prepress, Standards and accessibility

Views

60

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

Print Dialog Presets - Change Default DuplexMode attribute

Community Beginner ,
Jul 15, 2020

Copy link to clipboard

Copied

Hi there,

How can I change default value of DuplexMode property in Print Dialog Presets to 'Duplex Flip Long Edge'? I need every new PDF file to be created with duplex mode by default. Any suggestions?

 

Or is it possible to achieve this programatically, say using JavaScript etc.?

Adobe Community Professional
Correct answer by ls_rbls | Adobe Community Professional

Sure !

 

Below is a script that I was able to figure out to help another user. 

 

I started learning JavaScript in January 2020 (still learning), and in about a month and a half I was able to come up with this: 

 

 

 

app.alert("Document is now Printing");

var pp2 = this.getPrintParams();
pp2.firstPage = 2;
pp2.lastPage = 6;
pp2.interactive = pp2.constants.interactionLevel.automatic;
pp2.DuplexType = pp2.constants.duplexTypes.DuplexFlipLongEdge;
pp2.pageHandling = pp2.constants.handling.fit;
pp2.printerName = "";
if (this.getField("CH.2").value == "Yes") {this.print(pp2)};

var p2 = app.thermometer; 
p2.duration = this.print(pp2);
p2.begin();
for ( var i = 0; i < this.print(pp2); i++)
{
p2.value = i;
p2.text = "Printing pages 3-5"; break; 
}
p2.end(); 


var pp4 = this.getPrintParams();
pp4.firstPage = 9;
pp4.lastPage = 9;
pp4.interactive = pp4.constants.interactionLevel.automatic;
pp4.DuplexType = pp4.constants.duplexTypes.simplex;
pp4.pageHandling = pp4.constants.handling.fit;
pp4.printerName = "";
if (this.getField("CH.4").value == "Yes") {this.print(pp4)};

var p4 = app.thermometer; 
p4.duration = this.print(pp2);
p4.begin();
for ( var i = 0; i < this.print(pp4); i++)
{
p4.value = i;
p4.text = "Printing page 8"; break; 
}
p4.end();


var pp6 = this.getPrintParams();
pp6.firstPage = 11;
pp6.lastPage = 16;
pp6.interactive = pp6.constants.interactionLevel.automatic;
pp6.DuplexType = pp6.constants.duplexTypes.DuplexFlipLongEdge;
pp6.pageHandling = pp6.constants.handling.fit;
pp6.printerName = "";
if (this.getField("CH.6").value == "Yes") {this.print(pp6)};

var p6 = app.thermometer; 
p6.duration = this.print(pp6);
p6.begin();
for ( var i = 0; i < this.print(pp6); i++)
{
p6.value = i;
p6.text = "Printing pages 10-15"; break; 
}
p6.end();


var pp8 = this.getPrintParams();
pp8.firstPage = 17;
pp8.lastPage = 17;
pp8.interactive = pp8.constants.interactionLevel.automatic;
pp8.DuplexType = pp8.constants.duplexTypes.simplex;
pp8.pageHandling = pp8.constants.handling.fit;
pp8.printerName = "";
if (this.getField("CH.8").value == "Yes") {this.print(pp8)};

var p8 = app.thermometer; 
p8.duration = this.print(pp8);
p8.begin();
for ( var i = 0; i < this.print(pp8); i++)
{
p8.value = i;
p8.text = "Printing page 16"; break; 
}
p8.end();


var pp9 = this.getPrintParams();
pp9.printRange=[[22,22]]
pp9.printRange.push([23,24]);
pp9.interactive = pp9.constants.interactionLevel.silent;
pp9.pageHandling = pp9.constants.handling.fit;
pp9.printerName = "";
this.print(pp9);

var p9 = app.thermometer; 
p9.duration = this.print(pp9);
p9.begin();
for ( var i = 0; i < this.print(pp9); i++)
{
p9.value = i;
p9.text = "Printing pages 21-23"; break; 
}
p9.end();

 

 

 

 

You can use the original discussion as a reference  here (back in 17 February 20202):    Print based on boxes checked 

 

And there are plenty of excellent tutorials and discussions here in the forums that you can search and find useful.

 

But everything you need to know about the  getPrintParams method   is very clearly explained with examples in the following guidance:

 

 

So with some reading it is really not that complicated. It could get really complicated though. 

 

Be aware that the reference above is almost 800 pages long, so happy reading!

 

NOTE:

In my personal opinion, I did all the work for that other user and the individual never marked my solution as correct answer; that kind of hurt my "Adobe" wannabe..neverwas... Alter-ego ... specially after so much effort. 

 

But anyway, there's an old Japanese proverb that one old teacher shared with me when I was younger:

 

"Empty yourself completely to be filled up abundantly"

TOPICS
Acrobat SDK and JavaScript, Create PDFs, Print and prepress, Standards and accessibility

Views

61

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
Jul 15, 2020 0
Adobe Community Professional ,
Aug 07, 2020

Copy link to clipboard

Copied

Yes you can achieve this programmatically with JavaScript.

 

I personally prefer this method  since it gives you the felxibility to print the entire document to one printer, or, to even select specific pages of your PDF (or a range of pages)  and output each print session to different printers in a networked enviornment. 

 

Let's say you have a page that needs to be printed for someone in  human resources in a different office, but you also need to send for review about 10 other pages of the same document to the finance office; you can instruct the print action to programatically output these print sets to a different  printer physically located in those areas. And all is done  with a single click of a button using a  mouse-up action with a button, for example.

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 07, 2020 0
Community Beginner ,
Aug 07, 2020

Copy link to clipboard

Copied

Thank for your reply. Would you care to elaborate a little ? At least could you provide the JS class and method name in Acrobat that I can make use of to do this or any reference thread on this topic.

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 07, 2020 0
Adobe Community Professional ,
Aug 07, 2020

Copy link to clipboard

Copied

Sure !

 

Below is a script that I was able to figure out to help another user. 

 

I started learning JavaScript in January 2020 (still learning), and in about a month and a half I was able to come up with this: 

 

 

 

app.alert("Document is now Printing");

var pp2 = this.getPrintParams();
pp2.firstPage = 2;
pp2.lastPage = 6;
pp2.interactive = pp2.constants.interactionLevel.automatic;
pp2.DuplexType = pp2.constants.duplexTypes.DuplexFlipLongEdge;
pp2.pageHandling = pp2.constants.handling.fit;
pp2.printerName = "";
if (this.getField("CH.2").value == "Yes") {this.print(pp2)};

var p2 = app.thermometer; 
p2.duration = this.print(pp2);
p2.begin();
for ( var i = 0; i < this.print(pp2); i++)
{
p2.value = i;
p2.text = "Printing pages 3-5"; break; 
}
p2.end(); 


var pp4 = this.getPrintParams();
pp4.firstPage = 9;
pp4.lastPage = 9;
pp4.interactive = pp4.constants.interactionLevel.automatic;
pp4.DuplexType = pp4.constants.duplexTypes.simplex;
pp4.pageHandling = pp4.constants.handling.fit;
pp4.printerName = "";
if (this.getField("CH.4").value == "Yes") {this.print(pp4)};

var p4 = app.thermometer; 
p4.duration = this.print(pp2);
p4.begin();
for ( var i = 0; i < this.print(pp4); i++)
{
p4.value = i;
p4.text = "Printing page 8"; break; 
}
p4.end();


var pp6 = this.getPrintParams();
pp6.firstPage = 11;
pp6.lastPage = 16;
pp6.interactive = pp6.constants.interactionLevel.automatic;
pp6.DuplexType = pp6.constants.duplexTypes.DuplexFlipLongEdge;
pp6.pageHandling = pp6.constants.handling.fit;
pp6.printerName = "";
if (this.getField("CH.6").value == "Yes") {this.print(pp6)};

var p6 = app.thermometer; 
p6.duration = this.print(pp6);
p6.begin();
for ( var i = 0; i < this.print(pp6); i++)
{
p6.value = i;
p6.text = "Printing pages 10-15"; break; 
}
p6.end();


var pp8 = this.getPrintParams();
pp8.firstPage = 17;
pp8.lastPage = 17;
pp8.interactive = pp8.constants.interactionLevel.automatic;
pp8.DuplexType = pp8.constants.duplexTypes.simplex;
pp8.pageHandling = pp8.constants.handling.fit;
pp8.printerName = "";
if (this.getField("CH.8").value == "Yes") {this.print(pp8)};

var p8 = app.thermometer; 
p8.duration = this.print(pp8);
p8.begin();
for ( var i = 0; i < this.print(pp8); i++)
{
p8.value = i;
p8.text = "Printing page 16"; break; 
}
p8.end();


var pp9 = this.getPrintParams();
pp9.printRange=[[22,22]]
pp9.printRange.push([23,24]);
pp9.interactive = pp9.constants.interactionLevel.silent;
pp9.pageHandling = pp9.constants.handling.fit;
pp9.printerName = "";
this.print(pp9);

var p9 = app.thermometer; 
p9.duration = this.print(pp9);
p9.begin();
for ( var i = 0; i < this.print(pp9); i++)
{
p9.value = i;
p9.text = "Printing pages 21-23"; break; 
}
p9.end();

 

 

 

 

You can use the original discussion as a reference  here (back in 17 February 20202):    Print based on boxes checked 

 

And there are plenty of excellent tutorials and discussions here in the forums that you can search and find useful.

 

But everything you need to know about the  getPrintParams method   is very clearly explained with examples in the following guidance:

 

 

So with some reading it is really not that complicated. It could get really complicated though. 

 

Be aware that the reference above is almost 800 pages long, so happy reading!

 

NOTE:

In my personal opinion, I did all the work for that other user and the individual never marked my solution as correct answer; that kind of hurt my "Adobe" wannabe..neverwas... Alter-ego ... specially after so much effort. 

 

But anyway, there's an old Japanese proverb that one old teacher shared with me when I was younger:

 

"Empty yourself completely to be filled up abundantly"

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 07, 2020 0
Sapeksh LATEST
Community Beginner ,
Aug 07, 2020

Copy link to clipboard

Copied

Appreciate your efforts. Thank you.

Turns out the Acrobat JS API Reference file that I was referring for my development was quite old (Adobe Acrobat 7.0) and its PrintParameters object does not have a .duplexTypes property then. This is why I was not able to find it. 

Not sure how where I got hold of it from and never noticed its version & year! Your answer led me to the newer version. (Hope it's the latest one.)

Anyway, with your help, I would able to finish my development now.  

Thanks again! 🙂

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 07, 2020 1