Solved

Disable Printer Dialog Box when Printing

Posted on 2001-08-14
6
742 Views
Last Modified: 2007-12-19
Is there any to print from a web page without displaying the printer dialog box.
The company security settings hide the printer settings, so when users try printing from IE an error occurs because the printer dialog box cannot be displayed.
I need to bypass the printer dialog box.
0
Comment
Question by:Scamp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 8

Accepted Solution

by:
drittich earned 200 total points
ID: 6383840
You can use this JavaScript function:

function printit(){
    if (NS) {
        window.print() ;
    } else {
        var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
        WebBrowser1.ExecWB(6, 2); //Use a 1 vs. a 2 for a prompting dialog box
        WebBrowser1.outerHTML = "";
    }
}

And call it with a button like this:

<input type=button value="Print" onClick="printit()">

0
 
LVL 8

Expert Comment

by:drittich
ID: 6383858
Try this instead:


<html>
<head>
<title></title>
<script language="javascript">
function printit(){
   if (NS) {
       window.print() ;
   } else {
       var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
   document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
       WebBrowser1.ExecWB(6, 2); //Use a 1 vs. a 2 for a prompting dialog box
       WebBrowser1.outerHTML = "";
   }
}

</script>

</head>
<body>
some text to be printed...<br>


<SCRIPT Language="Javascript">
var NS = (navigator.appName == "Netscape");
var VERSION = parseInt(navigator.appVersion);
if (VERSION > 3) {
    document.write('<form><input type=button value="Print this Page" name="Print" onClick="printit()"></form>');
}
</script>
</body>
</html>


0
 

Author Comment

by:Scamp
ID: 6383950
Thankyou very much Drittich - works brilliantly!
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 20

Expert Comment

by:jitganguly
ID: 6384382
Guys,
Just curious, is that compatible to NN also ?
0
 
LVL 8

Expert Comment

by:drittich
ID: 6387021
Umm, not sure.
0
 
LVL 20

Expert Comment

by:jitganguly
ID: 6388536
I don't think. and that was my problem
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question