This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes Printing a server file to client side printer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Printing a server file to client side printer" Watch "Printing a server file to client side printer" New topic
Author

Printing a server file to client side printer

Shruti Gongle
Greenhorn

Joined: Jun 27, 2001
Posts: 8
Help!!!
I want to print a file which is on my server to a printer on client side.I wrote a servlet for it...but the page got printed on the server side.Does anyone know how to do this....
I hope this does not sound a stupid query...
Peter Kristensson
Ranch Hand

Joined: Jul 02, 2001
Posts: 118
What you have here isn't really a JSP-question.
I suggest that you display the file in the browser (on the client) and have the user press file -> print, or supply some "print" button using javascript, do a search on "print" on javascript.internet.com, I tried and got 45 hits.
Shruti Gongle
Greenhorn

Joined: Jun 27, 2001
Posts: 8
Thanks much Peter for your prompt response.The solution u have given is right but my case is a bit different. To tell the details...i am fiddling with Jasper Reports . Its a very good tool for report generation using java. U can create PDF/XML reports and aslo u can create a file which is in ready to print format. So on my web page i want to give the users an option to directly print a file. As it is if i show the user the PDF file he can directly print the report. But i wanna try out direct print....have u done any thing of this sort???
s.r.k.reddy
Greenhorn

Joined: Jul 15, 2002
Posts: 10
If at all it is printing on the browser then obviously the report will appear on the browser, It's COM.
If this is the case then the javascript
//This can make automatically print a doc on the client side;
//Never tried but can you insert this HTML in the output which is pdf?
<script type="text/javascript">
if(window.print)
window.print()
else
alert("no printer found");
</script>
may be of no use; as the pdf is a independent component embedded on HTML, if at all we try using javascript then it cannot completely print the document as it will just print the window I Guess...Never tried...


s.r.k.reddy<br />Good Luck.
Shruti Gongle
Greenhorn

Joined: Jun 27, 2001
Posts: 8
Can anyone tell me how to print a server side file on the client side without displaying it on the client side browser???
 
wood burning stoves
 
subject: Printing a server file to client side printer