Solved

document.print without dialog box

Posted on 2004-10-04
7
252 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
[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
  • 2
  • 2
7 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 250 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

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!

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

705 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