faqts : Computers : Programming : Languages : PHP : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

17 of 19 people (89%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

How to print from a client under Windows?

Jul 25th, 2000 16:43
Jason Korth, Matt Gregory, Loick DINARD, unknown unknown, http://devedge.netscape.com/docs/manuals/js/client/jsref/window.htm#1203138


This is how you do it..

Keep in mind this will only work with newer browsers, 4 and up I think. 
The Javascript parser on the browser needs to support the print method 
for the document object. You can read about it here.

http://devedge.netscape.com/docs/manuals/js/client/jsref/window.htm#1203
138

-----------------------------------------------------------------------

If you want to have it automatically print when the document loads, 
make it so php generates the body tag with this in it...

<body onLoad="window.print();" >

OR if you want a button..

<input type=button name=mrbutton onClick="window.print();">

Or if you want a link..

<A href=javascript:window.print()>PRINT</a>

It doesn't actually print, it just brings up that print box thing as if 
you clicked on File, Print. Or hit <CTL> P

But that's the best you're going to do.

Hope that helps.