Print directly from browser without print popup window [duplicate]

I couldn’t find solution for other
browsers. When I posted this question, IE was on the
higher priority and gladly I found
one for it. If you have a solution
for other browsers (firefox, safari, opera) please do share here.
Thanks.

VBSCRIPT is much more convenient than creating an ActiveX on VB6 or C#/VB.NET:

<script language="VBScript">
Sub Print()
       OLECMDID_PRINT = 6
       OLECMDEXECOPT_DONTPROMPTUSER = 2
       OLECMDEXECOPT_PROMPTUSER = 1
       call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)
End Sub
document.write "<object ID='WB' WIDTH=0 HEIGHT=0 CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></object>"
</script>

Now, calling:

<a href="https://stackoverflow.com/questions/1096862/javascript:window.print();">Print</a>

will send print without popup print window.

Leave a Comment