Here's my .02cents worth. I will point out that (at least in IE 5.5 not sure
about NS or lower versions of IE) you can print directly to someone's
printer when a page loads, without popping up a dialog box and without them
having to click on anything. I have been doing this now for sometime
internally for printing reports. Keep in mind that formatting using an HTML
printed document can be difficult to control with such a wide range of
systems and setups but... I think if it's kept simple it can be done. PS you
can print anything that prints normally with an HTML page, logos included.
;-)  Keep reading if your interested.

My situation was as follows:
What I needed was to query a db (using CF) and have results printed
automatically. I only needed it to work with IE 5.5 and I didn't care if it
displayed on screen.

I found some code here
http://www.javascriptcity.com/forums/index.php3?action=faq#qj6
but had to modify it...

This code still popped up the print dialog box and I can do that by putting
onload="window.print();" in the <body> tag.
What I wanted was to print the cfm (htm) file when it loaded, without
popping up the print dialog box.

I tweaked the code a little and ended up with this:

<SCRIPT>
<!--
function printit(){
if (document.all) {
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, 6); //Use a 1 vs. a 6 for a prompting dialog box
WebBrowser1.outerHTML = "";
}
}
//-->
</script>

You also have to put onload="printit();" in the <body> tag for it to print
when the page loads or you could associate it with a print button etc (just
set whatever you click on to call the printit() function).

The modified code prints the cfm (htm) file to the users default printer
using default settings without putting up any dialog boxes but it still
displays the cfm (htm) file onscreen. Again, I know it works in IE 5.5 not
sure about anything else. I haven't tested it in NS. I didn't have a need to
support NS or any browser other than IE 5.5.

One thing to "get around" displaying onscreen would be to use a hidden frame
for the "printing" htm page and put up a generic display page.

Hope this helps

Stephen



-----Original Message-----
From: Christopher Olive, CIO [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 09, 2001 9:38 PM
To: CF-Talk
Subject: RE: Print without bringing print dialogue?


actually, you can't.  it's a JS security feature.

chris olive, cio
cresco technologies
[EMAIL PROTECTED]
http://www.crescotech.com



-----Original Message-----
From: Nathan Chen [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 09, 2001 12:46 PM
To: CF-Talk
Subject: Print without bringing print dialogue?


Hi, All:

I posted this before the list went down a few weeks ago. I don't know if
it went though so I re-post it.

I need to know how to print a cfm page without bringing up the print
dialogue from the browser.  If I use window. print() method, the print
dialogue will popup. But what I need is to send the displayed
information to the printer directly without bringing this print dialogue
box.  Is this possible? Any hint or suggestion will be appreciated.

Nathan Chen
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to