Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Disable Printer Dialog Box when Printing

Posted on 2001-08-14
6
Medium Priority
?
745 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
  • 3
  • 2
6 Comments
 
LVL 8

Accepted Solution

by:
drittich earned 800 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Loops Section Overview
Suggested Courses

886 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