Printer Friendly Page ASP Script - ASP Web Pro
  Active Server Pages Programming by ASP Web Pro

ASP Scripts

PRINTER FRIENDLY PAGE

A lot of websites include valuable information that needs to be printed by the user. It could information like a news article, instructions, directions, or anything else. Sometimes you may even want your entire website to be printable. The problem is that when you print your page, the printout is not formatted correctly and all of these extra banners, menus, etc get printed as well. Well this "Printer Friendly Page" is the answer you have been looking for. There are actually a few different ways to accomplish this, here is one of them.

All you have to do is create a page called printerpage.asp and copy the code below:

<HTML>
<HEAD><TITLE>Printer Friendly Page</TITLE></HEAD>
<BODY>
<%
DIM view
view=request.querystring("view")
IF view <> "print" THEN
%>

<TABLE width="100%" border="0">
<TR><TD><IMG SRC="images/topbanner.gif"></TD></TR>
</TABLE>
<TABLE width="100%" border="0">
<TR><TD width="15%"><B>My Website Menu</B><BR>
History<BR>
Products<BR>
Services</TD>
<TD>Print this information.</TD>
</TABLE>

<P>&nbsp;</P>
<A HREF="<%=request.servervariables("script_name")%>?view=print">Printer Friendly Page</A>

<% ELSE %>
<P>Print this information.</P>

<A HREF="<%=request.servervariables("script_name")%>?view=view">Return to Regular View</A>

<% END IF %>

</BODY>
</HTML>

The first time you access the page, it will display your banner and menu items. If you click the Printer Friendly Page link, the page will refresh itself with only the text you want printed.

< Back to ASP Scripts


 

 

Main Menu
Home
ASP Scripts
ASP Tutorials
JavaScripts
Awards
Contact Us

Email This Page

Other Resources
ASP Web Hosting
Search Engine Submission
Programming Help

 

 

 

Other ASP Web Sites

Site Map

 

Last Updated:
16 March 2010