welcome Netizen

welcome Netizen
Hi folks this site Share Basic Knowledge in .NET, DotNet, C#,DOT NET CODE, ASP.NET, VB.NET, DOT NET TRICKS,Dotnetcode,Android and Latest Technology Articles in VB,Android and ASP.NET

Saturday, March 17, 2012

Print a webpage using


Here you have find the code to print a whole web page using html button. To print a page we use window. Print JavaScript .But its having a drawback print with button control, this button control we don’t like button come on the printing page, so we have to avoid the button printing using CSS.
<html xmlns="">
<title>Hide print button</title>
<style type="text/css" media="screen">
<style type="text/css" media="print">
<form id="PrintForm" runat ="server">
 print a page  with button hide</h1>

<br />
    <img src="images/k4.jpg" height ="100" width="100" />
<input id="btnPrint" type="button" value="Print" class="PrintButton" onclick="window.print();" />

Suppose if you want to close the window automatically after taking print out then add the below script in your page. It will close the page after taking printout

<script type="text/javascript">
        function revertback() {
       window.onafterprint = revertback

Here you seen to take print out the page and learn to close a page after took print out.
I hope you like this article post your comments..


Post a Comment