As it said in the subject I've to create a feature for a web-based application that will allow users to send print directly without prompting any dialog boxe just make the print i.e click and print, simple! but not for me :(.
Please, suggest what would be the best option and how should I write it up (technology).
Suggest please!
Thanks.
EDIT: The print should be send on the user's default printer.
The fix is pretty simple. You just need to call Print() itself, instead of window. print() in the onclick event.
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="javascript:window.print();">Print</a>
will send print without popup print window.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With