Ryan Boudreaux addresses the issue of setting options via CSS that allows users to print documents from the web. He provides some resources to help you find a web printing solution.
How many times do you visit an organization's web on the Internet and find it a daunting experience to print out the content? There are many browser tools available that allow the viewer to print web content, but is it really meaningful? Don't you want to control how your web content gets printed, and not let the browser or user make that decision for you?
Do you get around this issue with your own print style sheets, printing widgets, add-ins, or third-party printing web applications? Or is your organization not offering options to print from the web, maybe as a way of making a "green" statement; on the other hand, many folks do not print out web pages at all and this is not an issue.
Considerations for web print options are determined by exactly what content you or your organization wants the browser or user agent to print. Will navigation be included in the print? Typically it is not, but how many times have you printed out a web page from the user agent only to find the top inch or two on the paper is the linking and navigation? Most times the navigation is not very useful information in print form! And what about background images and background colors? The viewer would much appreciate not having to use up a large amount of color ink for unnecessary backgrounds; they just want to read the content, or look at an image. Backgrounds are great on web pages, but when printed, the text is often unreadable. Then you have to think about the text colors, font sizes, content print area sizing, and comments. There are many factors to take into account when developing your web printing strategy.
In my experience, I end up copying the textual and image content that I want to print out, and pasting it into a text file or word processing document and print it from there. This way I can control my own formatting and then save the document if needed for later printing, but most folks do not want to spend the time doing this sort of chore.
There is really no one-size-fits-all solution to creating a print option when it comes to web development. The user experience can vary depending on the browser user agent and version when the page is viewed. The rules for print CSS can be quite buggy at times when purely defining the print specifications for a set of web documents. When going the CSS route for web printing, the simplest way is to declare it in the web documents to be printed, and it should be defined with code similar to this link element:
<link rel="stylesheet" type="text/css" media="print" href="print.css">
Of course, then you need to build out a print CSS to contain all the styles you define. Here are several sampled resources available for creating a web printing solution:
- Designer Depot offers this short tutorial entitled, 10 Tips for Better Print Style Sheets. This is a good starting point for creating CSS code to manipulate web printing options.
- Sitepoint Forum: CSS and Printing: Best Practices. A discussion on best practices for CSS and web printing.
- Smashing Magazine: Printing the Web: Solutions and Techniques. This article list includes a dozen or so solutions and techniques for printing from the web.
- 24 Ways: Back to the Future of Print. This article lists a good set of best practices, tips and tricks when adding print specifications to your web documents.
- CSS-Discuss Wiki: Media Stylesheets. Covers several media types and outlines for preparing print stylesheets.
What solution does your organization use for printing from the web?