I have a link button executing very simple javascript to print and it works, but the print out is really small. Is there a simple way to zoom or increase the size of the print? See my code below:
<asp:LinkButton ID="lbPrint" runat="server" Text="Print this agreement"
OnClientClick="javascript:window.print()" />
This is the solution that worked for me. See my code below:
The linkbutton calls a Javascript function in the OnClientClick event named tablePrint()
<asp:LinkButton ID="lbPrint" runat="server" Text="Print this agreement"
OnClientClick="tablePrint();" OnClick="lbPrint_Click" />
The area of my webpage that I want printed was placed inside a div tag that I gave an ID so the javascript can access it.
<div id="printable">
<asp:Panel ID="Panel1" runat="server">
<asp:Label ID="HeaderLabel" runat="server" Text="Some Text for a header here" />
</asp:Panel>
<div>
<asp:Label ID="BodyLabel" runat="server" Text="Some text or html for a body here" />
</div>
</div>
cool.asp
Member
545 Points
190 Posts
Print Text Size Javascript
Apr 26, 2012 07:11 PM|LINK
I have a link button executing very simple javascript to print and it works, but the print out is really small. Is there a simple way to zoom or increase the size of the print? See my code below:
<asp:LinkButton ID="lbPrint" runat="server" Text="Print this agreement" OnClientClick="javascript:window.print()" />Thank you.
roopeshreddy
All-Star
20155 Points
3328 Posts
Re: Print Text Size Javascript
Apr 27, 2012 05:18 AM|LINK
Hi,
You can have StyleSheet for Print, which has increased/custom text size for printing!
Hope it helps u...
Roopesh Reddy C
Roopesh's Space
cool.asp
Member
545 Points
190 Posts
Re: Print Text Size Javascript
Apr 28, 2012 07:03 PM|LINK
This is the solution that worked for me. See my code below:
The linkbutton calls a Javascript function in the OnClientClick event named tablePrint()
<asp:LinkButton ID="lbPrint" runat="server" Text="Print this agreement" OnClientClick="tablePrint();" OnClick="lbPrint_Click" />The area of my webpage that I want printed was placed inside a div tag that I gave an ID so the javascript can access it.
<div id="printable"> <asp:Panel ID="Panel1" runat="server"> <asp:Label ID="HeaderLabel" runat="server" Text="Some Text for a header here" /> </asp:Panel> <div> <asp:Label ID="BodyLabel" runat="server" Text="Some text or html for a body here" /> </div> </div>I slightly modified the Javascript referenced here: http://nice-tutorials.blogspot.com/2009/05/print-using-javascript.html
See my Code below:
<script type="text/javascript"> function tablePrint() { var display_setting = "toolbar=yes,location=no,directories=yes,menubar=yes,"; display_setting += "scrollbars=yes,width=750, height=600, left=100, top=25"; var content_innerhtml = document.getElementById("printable").innerHTML; var document_print = window.open("", "", display_setting); document_print.document.open(); document_print.document.write('<html><head><title>Disclaimer Agreement </title></head>'); document_print.document.write('<body style="font-family:verdana; font-size:14px;" onLoad="self.print();self.close();" >'); document_print.document.write(content_innerhtml); document_print.document.write('</body></html>'); document_print.print(); document_print.document.close(); return false; } </script>