Forum Moderators: open

Message Too Old, No Replies

Printing current page

How to...

         

hexdj

11:01 pm on Dec 15, 2005 (gmt 0)

10+ Year Member



I want to have several pages printed directly from the current page, I've noticed it's done with Javascript, how can I do it?

I want particularly a cell from a table to be printed, nothing else, no menu, no pictures, etc, is this possible?

Thanks in advance.

le_gber

8:58 am on Dec 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi hexdj,

Yes it is possible, what you need is to define a stylesheet for the screen and anotherone for print(like below)

<link href="" rel="stylesheet" type="text/css" media="print" />
<link href="" rel="stylesheet" type="text/css" media="screen" />

On the print stylesheet just make every elements you don't want invisible. You may have to work with positioning as well but this is to get you started.

Hope this helps

hexdj

6:11 pm on Dec 16, 2005 (gmt 0)

10+ Year Member



That helps a lot, thanks, but how about a link that says PRINT THIS PAGE and when it gets clicked on people see the Printing Menu just like when you'd go to File/Print in your browser?

Fotiman

6:23 pm on Dec 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I think you want:

window.print()

hexdj

9:09 pm on Dec 16, 2005 (gmt 0)

10+ Year Member



yes that was it! Thank you!