Print Query in JSP

 
 

Hi,
I want to print the document which i select or the part which I want. How can i?? Because if simply i use print it will print the whole dialog of the screen but i need to print as we see in the bills that it just displays the amounts which we entered and name of the item. It is part of my project so kindly help me


You have to put a link

You have to put a link something similar to "view printable virsion"..
clicking this link would popup a page with contains the exact bill layout with the appropriate information with can be easily done through JSP.
now put a 'print' link/button and use some javascript like given below..

creating a link like this Click to Print This Page 

here's the code: <A HREF="javascript:window.print()">Click to Print This Page</A>


You can set it to print off of an image:

<A HREF="javascript:window.print()">
<IMG SRC="print_image.gif" BORDER="0"</A>


You can set it to trigger off a button:

<FORM>
<INPUT TYPE="button" value="Click to Print" onClick="window.print()">
</FORM>


or you can do it directly adding onLoad to force a print request when the page loads:

onLoad="window.print()"


cheers..