Archive for the ‘Seminars By Team’ Category

 

print web page without showing print dialogbox

Monday, March 14th, 2011

Here’s what you need to do to enable Firefox immediately print without showing the print preferences dialog box.

  1. Type about:config at Firefox’s location bar and hit Enter.
  2. Right click at anywhere on the page and select New > Boolean
  3. Enter the preference name as print.always_print_silent and click OK.

For IE

function printit(){
if (window.print) {
window.print() ;
} else {
var WebBrowser = ‘<OBJECT ID=”WebBrowser1″ WIDTH=0 HEIGHT=0 CLASSID=”CLSID:8856F961-340A-11D0-A96B-00C04FD705A2″></OBJECT>’;
document.body.insertAdjacentHTML(‘beforeEnd’, WebBrowser);
WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = “”;
}
}

Site map | Blog
Copyright © 2008, COG IT Solutions Pvt. Ltd. All Rights Reserved
XHTML Validated