Can I set Adobe so that whenever I click print it prints immediately instead of showing the print preview?
Can I set Adobe so that whenever I click print it prints immediately instead of showing the print preview?
Can I set Adobe so that whenever I click print it prints immediately instead of showing the print preview?
Hi markosd88
By default, there is no such option to override print dialog window.
You may check this out: Silent Print in Acrobat Using JavaScript and let us know if that helps.
-Tariq Dar
The following code and message is something I managed to pull from the archive of the blog link mentioned above, which is no longer available:
Here’s some code: -------------------------------Start---------------------------
// if the application is Adobe Acrobat...
//then create the silent print button
if(app.viewerType == "Exchange-Pro") {
app.trustedFunction(customSilentPrint);
app.addToolButton({
cName: "customSilentPrint",
cExec: "customSilentPrint()",
cTooltext: "Print Silent",
cLabel: "Print Silent",
cEnable: "event.rc = (app.doc != null)" });
}
function customSilentPrint(){
// explicitly raise privileges
app.beginPriv();
try{
// get the printer params
var pp = this.getPrintParams();
// don't show the print dialog window
pp.interactive = pp.constants.interactionLevel.silent;
}
catch(err){
app.alert("Error setting up printing parameters.\n\n" + err);
}
try{
this.print(pp);
}
catch(err){
app.alert("Error Printing.\n\n" + err);
}
// end explicit privileges
app.endPriv();
}
As you can see, there really isn’t much to this code, but let’s break it down.
First, we check to ensure we are in Acrobat, and if so, we add the button called “Print Silent” to the Acrobat toolbar:
// if the application is Adobe Acrobat...then create the silent print button
if(app.viewerType == "Exchange-Pro") {
app.trustedFunction(customSilentPrint);
app.addToolButton({
cName: "customSilentPrint",
cExec: "customSilentPrint()",
cTooltext: "Print Silent",
cLabel: "Print Silent",
cEnable: "event.rc = (app.doc != null)" });
}
Next, we create the function called customSilentPrint and raise privileges:
function customSilentPrint()
{ // explicitly raise privileges
app.beginPriv();
Within the function, we get to the meat of the work by creating a print params object and setting the interaction Level to silent.
Try {
// get the printer params
var pp = this.getPrintParams();
// don't show the print dialog window
pp.interactive = pp.constants.interactionLevel.silent;
}
Now that we are set up to print silent, call the print function with these lines:
try {
this.print(pp); }
catch(err){ app.alert("Error Printing.\n\n" + err); }
To finish off our code we lower our privileges and close out the function:
// end explicit privileges app.endPriv(); }
As you can see there’s really no magic here, but this JavaScript code is a nifty little way to print silently in Acrobat.
Also, I haven’t researched silent printing using a reader, but if you have tried it and succeeded or failed, please feel free to add to the post via comments.
-------------------------------------------------------------Ends-----------------------------------------------
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.