posts - 47, comments - 14, trackbacks - 438748

Cached @ 9/7/2008 9:38:34 PM

Control ASP.skins_anothereon001_controls_blogstats_ascx

My Links

News

Archives

Post Categories

Blogs

Cached @ 9/7/2008 9:38:34 PM

Control ASP.skins_anothereon001_controls_singlecolumn_ascx

JavaScript Print Button

To implement a print button on a web page, you can use the window.print() javascript function.  The following example shows an image that is displaying a printer icon and will print the current page when clicked.

Code:
<img border="0" onclick="window.print();" src="/images/PrintIcon.gif" style="cursor:hand;" />
(Replace the text /images/PrintIcon.gif with the location of an icon in your site.)

Example:

A better application of this idea is to first create a page that renders a print preview of the information you want to print.  This print preview will look similar to the original page but will not contain navigation items, header images, or other page clutter.  Furthermore, the data can be formatted to fit cleanly on 8.5" x 11" paper.  Embed the print icon in the print preview page and allow users to print from there.

Print | posted on Tuesday, June 24, 2008 8:19 AM | Filed Under [ ASP.NET ]

Comments have been closed on this topic.

Powered by: