Reputation: 702
i want to print a document/my report from browser using window.print(). I want browser not to show standart print dialog on current machine and not to show the web page. I have all access to system registry and settings on it. Is there way to tweak the system in this way?
Upvotes: 0
Views: 2034
Reputation: 2359
Here's a solution which was posted on the codingforums.com - Disabling the print dialog box
<html>
<head>
<title>Print Test</title>
<script>
function Print()
{
if (document.all)
{
WebBrowser1.ExecWB(6, 6) //use 6, 1 to prompt the print dialog or 6, 6 to omit it;
WebBrowser1.outerHTML = "";
}
else
{
window.print();
}
}
</script>
</head>
<body>
<object ID="WebBrowser1" WIDTH="0" HEIGHT="0"
CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
</object>
<A HREF="#" onClick="Print()">Print this page</a>
</body>
</html>
It's noted by the user to only work with IE and fails with all NS browsers but users have validated that it works.
Upvotes: 2