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
Solved

document.print without dialog box

Posted on 2004-10-04
7
248 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Hide cell in a table 2 27
Google Analytics setup 5 50
How to make a good PHP + MySQL + JS pagination system? 3 32
Html value of radio 14 28
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

860 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