aspose file tools*
The moose likes Servlets and the fly likes Printing with servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Printing with servlets" Watch "Printing with servlets" New topic
Author

Printing with servlets

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Can anybody tell me how to print from a Servlet ?
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9053
    
  12
It depends on where you want to print to. If you want to print to the screen, use PrintWriter and out.print. If you want to print to an error log, use System.out.print. Or are you talking about printing to a printer?

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
And is the printer connected to the server or the client? Most HTML/Browser applications which have a "print" button, just use it to produce an alternatively formatted version of the same data which will print sensibly.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
vikinsa
Ranch Hand

Joined: Apr 18, 2001
Posts: 46
Hi,
There is no such way to get something printed by the servlet. But there is a good way in javascript. You can have the tested code from www.dynamicdrive.com This piece of code has a javascript function which can be called either from body onLoad or by any click event on the page. This is a good alternative to anything.
Try seraching <b>print</b> on www.dynamicdrive.com

------------------
Vikas Aggarwal
Technology Associate
(www.vikinsa.com)


Vikas Aggarwal<BR>Technology Associate<BR>http://www.vikinsa.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Printing with servlets