These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

choose aper source via api

ocean
Registered: Oct 30 2009
Posts: 3

hi,

i use this script to autoprint my pdf:

// path C:\Dokumente und Einstellungen\user\Anwendungsdaten\Adobe\Acrobat\9.0\JavaScripts
 
sPrint = app.trustedFunction(
function(bUI, bSilent){
app.beginPriv();
var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.automatic;
pp.printerName = "epson2";
pp.pageHandling = pp.constants.handling.none;
this.print(pp);
}
)

it works great :)

but it always prints with the option "auto rotate and center" :(
and it doesnt choose paper source by page size :(

my question:
how can i set the checkbox "choose paper source by pdf page size" option in the print dialog with the api ?

and how can i set the checkbox "auto rotate and center" option in the print dialog with the api ?

when it is not possible :
can i set anywhere the adobe´s default printer settings ?

thanks

ocean

radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
You can use the setPageSize flag, to activate "Choose paper tray by PDF size".

pp = getPrintParams();fv = pp.constants.flagValues;pp.flags |= (fv.suppressCenter | fv.setPageSize);this.print(pp);

See the JavaScript API Reference manual for more details of the PrintParams properties.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

ocean
Registered: Oct 30 2009
Posts: 3
thanks radzmar :)
Dchauhn
Registered: Jul 7 2011
Posts: 1
Try this script to achieve the same.

Place the below mentioned script on the click event on the "Print" button

var MyDoc = event.target;
var pp = MyDoc.getPrintParams();
var fv = pp.constants.flagValues;
pp.flags = fv.setPageSize=false;//Sets the Auto-Rotate and Center Flag
pp.interactive = 0;// 0=interactive, 1=auto, 2=silent
pp.pageHandling = 3;//3=shrink to fit
MyDoc.print(pp);

But this script will not work, if the user, print through "File" -> "Print"