Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Disable Printer Dialog Box when Printing

Posted on 2001-08-14
6
Medium Priority
?
744 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 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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/…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

704 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