Simplify your business
Tuesday, 7 October 2008 1:13 pm

Easy printer friendly pages

Thursday, 31 May 2007  

You don’t need to muck around with JavaScript, page redirection or PDF integration just to make your XHTML web pages printer friendly.

By far the simplest way is to define a separate stylesheet for printing purposes:

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

In your stylesheet, define your colour scheme to be black on white, use a medium size “serif” font, underline all links and remove any navigation, comment forms, calendars, sidebars, footers and any other meaningless stuff:

body {
   font-family: georgia, "times new roman", times, serif;
   color: #000000;
   background: #ffffff;
   font-size: 11pt;
}

a {
   text-decoration: underline;
}

#navigation, #sidebar, #calendar, #commentform, #footer, #advertising {
   display: none;
}

That’s it. There’s no separate page for printing, no additional programming and no silly “print this” buttons to worry about, for you or your users. When the user wants a printed version of your page, they simply either press Ctrl+P or choose File > Print from their browser menu.

Posted in CSS, HTML, Tips, Usability by Ivan
Blinklist icon Del.iocio.us icon Furl icon Reddit icon Technorati icon Yahoo! icon

 one comment:

  1. DK - Monday, 16 July 2007 10:16 pm  

    Really? Then why do we see so many pages on the web with "print me" type buttons? I get the feeling there's more to it then you're letting on.


Got something to say?

To protect your privacy, your email address will not be displayed.





Some basic rules for commenting:

  • Watch your language.
  • Keep comments on-topic and relevant.
  • You can use basic XHTML tags for formatting and linking but not bbcode.
  • Comments are moderated, so don't double post if your comment doesn't appear immediately.
  • Please proof-read your comments for spelling and grammar mistakes.
  • Watch your language.