Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

document.print without dialog box

Posted on 2004-10-04
7
Medium Priority
?
321 Views
Last Modified: 2011-10-03
I'm trying to use the document.print() function in order to automatically print a report page on load.

It works fine except that the Print dialog box comes up.

I'd like to know how I can get around so that the page would simply be printed without ANT user interaction.

I'm only interested in knowing how this can be done with IE. Thsis does not have to be compatible with any other browsers.

VERY URGENT!!!
0
Comment
Question by:zsoltvincze
  • 2
  • 2
5 Comments
 

Author Comment

by:zsoltvincze
ID: 12220489
Tried the posted article but it does not seem to work.  I tried both valuef of "1" and "2"

Can I get some more instructions about it?

My html is here:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>


<SCRIPT LANGUAGE=JavaScript>
function jprint()
{
        VBPrint();
}
</SCRIPT>

<object id=WBControl width=0 height=0 classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2></object>
<SCRIPT LANGUAGE=VBScript>
        Sub VBPrint() On Error Resume Next
        WBControl.ExecWB 6,2
        End Sub
</SCRIPT>


<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META http-equiv="Content-Style-Type" content="text/css">
<TITLE></TITLE>
</HEAD>
<BODY onload="jprint()">
ok
</BODY>
</HTML>

0
 
LVL 33

Accepted Solution

by:
sajuks earned 1000 total points
ID: 12223556
//try this
<html>
<head>
<script language="javascript1.2">
function print() {
    self.focus();
    document.body.insertAdjacentHTML("beforeEnd", "<object id='idWBPrint' width=0 height=0   classid='clsid:8856F961-340A-11D0-A96B-00C04FD705A2'></object>");
    idWBPrint.ExecWB(6, -1);
    idWBPrint.outerHTML = "";
}
-->
</script>
</head>
<body onload="print()">
hello world
</body>
</html>



0
 

Author Comment

by:zsoltvincze
ID: 12225256
Brings up the dialog just as well.

does it not when you open it?
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12233837
not in mine.ie 6 and w2k server
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

578 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