Solved

document.print without dialog box

Posted on 2004-10-04
7
242 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
7 Comments
 
LVL 13

Expert Comment

by:cLFlaVA
ID: 12219988
0
 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult 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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now