Saturday, July 11, 2009

html for printer-friendly page

Found this great article on how to code HTML for printer-friendly pages, and it works!

Here's the important snippet on how to code the HTML for a printer-friendly button option:

If you also want to add a "Print this page" button your blog, add the following HTML snippent anywhere on the page.

[a href="javascript:window.print()"]Print Page[/a]

Remember that the above creates a printer friendly version only in memory and directly submits it to the printer. The user is not able to see the electronic version of the print version unless he prints it to PDF using Acrobat or other PDF creation tools.

If you want to build a functionality like The New York Times or Wall Street Journal paper where readers have an option to convert any HTML page into a text only version which can then either be printed or saved an HTML text file for offline reading, stay tuned for the next part of this tutorial. It involves HTML forms and query parameters.

No comments:

Post a Comment