• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Printing with servlets

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody tell me how to print from a Servlet ?
 
Marilyn de Queiroz
Sheriff
Posts: 9061
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
vikinsa
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic