View Full Version : print direct to printer no print dialog box?
aamir
07-02-2002, 09:04 AM
hey!
How can I send current page directly to the default printer using javascripting without show the print dialog box to the user
right now I m using
<body onload="window.print(), window.close()>
waittttiiiiiiinnnnnnnnnnnggggggggggg :thumbsup:
requestcode
07-02-2002, 01:07 PM
This will work for IE only.
<script>
function Print() {
if (document.layers) {
window.print();
}
else
if (document.all) {
WebBrowser1.ExecWB(6, 6)
//use 6, 1 to prompt the print dialog or 6, 6 to omit it;
WebBrowser1.outerHTML = "";
}
}
</script>
<object ID="WebBrowser1" WIDTH="0" HEIGHT="0"
CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
</object>
<body onLoad="Print()">
brothercake
07-02-2002, 05:21 PM
I would strongly advise you don't do that, because
[list=1]
How do you know the user even has a printer?
Legally ... forcing a print like that without user interaction could be construed as theft (of electricity, paper and ribbon ink)
[/list=1]
aamir
07-02-2002, 06:40 PM
hey guys thanks alot for the help... :thumbsup: I'll chk it out the Jyoung's code
brothercake I have used that body tag in a page which loaded when use clicks a print button located on other page.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.