This code snippet shows how to implement a "printer friendly" version link for your pages.
The "Printer Friendly" version select the main content of your page, removing the menu, header graphics, advertising and foot content. The script performs the HTTP "get" method via the XMLHTTP object to retrieve the page to be printed. Using the XMLHTTP object instead of something like FSO means that the ASP page is actually executed and not just 'read' as a stream of characters.
ASSUMES THAT YOUR PAGE HAS PRINTABLE CONTENT WITHIN TWO COMMENTS:
<!-- content_starts_here //-->
............
<!-- content_ends_here //-->
You can find a live example in this page, follow the printer link.
The code is commented in the script.
(Needs MSXML 3.0 and VBScript version 5 or above installed on Server)
REVISION HISTORY:
V 2.0:
Problem with special characters ä, ö, å, æ, ø etc. now fixed