. . Hong Kong Business Software Company
Expert in web-based solutions
Software House in Hong Kong

Microsoft Certified Solution Developer

 

Chief Architect's Blog on software development

05 March 2008
Hide Print Button from Web Page Printout
Sometimes you might need to add a print button on your web page so that  your web page users know they can print out that page.  However, you might want them print out the page without showing the print button of your screen.

This can be done by using the CSS Style Sheet. You can link your page to two style sheets, one for screen display and the other for printout. The html code look like this:

<link media="print" href="print.css" rel="stylesheet" type="text/css" />
<link media="screen" href="screen.css" rel="stylesheet" type="text/css" />

Your print.css file must include a style similar to the below:

div.hidefromprint { display:none }

On your web page, controls that your do not want to display for printing should be bracketed with this style.

<div class="hidefromprint" >
This line hide from printout.
</div>


You can download the sample code from http://download.biswaretech.com/resources/printscreen.zip.