Entry
how to capture the print dialog box and customize the options in javascript (print 2 copies etc..)?
Apr 7th, 2008 23:06
ha mo, Colin Fraser, vrushali nadpurohit,
I am not sure exactly what you are after here, but I can take a stab at it.
Firstly, I am not sure that you can send parameters to the printer and
bypass the print dialog. However, one thing you can try is :
<script>
function noDialog(numcopy) {
var i = 1;
for (i; i==numcopy; i++) {
if ((navigator.appName == "Netscape")) {
window.print() }
else {
var mybrowser = "<OBJECT ID='brwsr' WIDTH=0 HEIGHT=0
CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'>
</OBJECT>";
document.body.insertAdjacentHTML('beforeEnd', mybrowser);
brwsr.ExecWB(6, -1)
}
} //for
}
</script>
<form name="prnform">
How many copies: <input type="text" name="prnumber">
<input type="button" onClick="javascript:noDialog(this.prnumber.value)">
</form>
I am pretty sure I got this working, ages ago, it should work now but I
had a lot of problems in IE 5 with this, from memory and evetually gave
it up as a bad loss. Then I recall seeing that it wont work in anything
less than IE 5.5. I am also sure I posted this solution, or something
like it, here once before, and there was an issue with the dialog, the
-1 turns it off or on or something. Sorry, I cannot remember.
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com