Page 1 of 1

Creating a printable version of a page

Posted: Tue Apr 21, 2009 9:54 am
by greyhoundcode
It isn't uncommon to see a printer icon with some title text along the lines of, "Click here to see a printable version."

What is the most common way of doing this? Would one normally use JQuery or equiv to change the stylesheet for example?

Re: Creating a printable version of a page

Posted: Tue Apr 21, 2009 10:00 am
by jmut
Personal preference really. What would you as a user prefer? Not discussing the non-js enabled users here guess you got it thought of.

Re: Creating a printable version of a page

Posted: Tue Apr 21, 2009 10:11 am
by greyhoundcode
Can't say I'm particularly worried about non-JS users, my concern is to make this adaptation is quickly and painlessly as possible. What other methods might you suggest, if I wasn't to use JS for instance?

Re: Creating a printable version of a page

Posted: Tue Apr 21, 2009 3:26 pm
by jmut
Well simple link to another page that has additinal ?print or /print to distinguish. User wouldn't really care as long as it is printable.
I wouldn't recommend any popups etc etc. Clean page with the appropriate styling of course. People can easily say file -> print or file -> save as

Re: Creating a printable version of a page

Posted: Sat Apr 25, 2009 12:16 pm
by kaszu
I prefer using CSS with media print, that eliminates need for javascript :)

Re: Creating a printable version of a page

Posted: Mon Jun 22, 2009 4:32 am
by Hexi
Thanks for taking the time to help, I really apprciate it.

Re: Creating a printable version of a page

Posted: Mon Jun 22, 2009 3:34 pm
by infiniteacuity
kaszu wrote:I prefer using CSS with media print, that eliminates need for javascript :)
I agree with this as it also contains it to 1 area for easy editing.

Re: Creating a printable version of a page

Posted: Mon Jun 22, 2009 4:36 pm
by pickle
kaszu wrote:I prefer using CSS with media print, that eliminates need for javascript :)
Not necessarily. He wants to have a webpage show the printable version, not just separate styling for printout.

While I would include the <link rel = "stylesheet" type = "text/css" href = "print.css" media="print" /> on every page, I think the best approach for making a "See what this page will look like in a printout" page would be to have the print icon point to a ?print page, like ~jmut suggested. On that page, do some PHP figuring to only include the print stylesheet if $_GET['print'] is present.