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

send data from servlet to printer

Ray Kumar
Greenhorn

Joined: Jan 22, 2002
Posts: 17
how to send output data directly to printer at the client from servlet
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
It can't be done directly (think about it -- how is the Servlet supposed to know about your printer?). The easiest thing is to put Javascript attached to your resulting HTML page that sends the page to the printer once it arrives at the browser... See this sample for how to do this in IE.
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Ray Kumar
Greenhorn

Joined: Jan 22, 2002
Posts: 17
Thanks for the reply.
In my case the response receiver is not browser, but a rich client(java application), uses http tunneling to servlet to get the data. servlet generates pdf stream or file at the server side, it is got to be printed at the client side.

any ideas will be appreciated.

Thanks !
Ken Boyd
Ranch Hand

Joined: Dec 10, 2003
Posts: 329
Never did it myself but javax.print.* might be of help.


SCJP, SCWCD, SCBCD, SCJD, BB Java2 and JSP1.1
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Yup. It won't be the Servlet's responsibility at all then; it's your rich client code's responsibility to print it. Look into javax.print as Nehul suggests.
Kyle
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

"PK"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it
here.
Thanks! and welcome to the JavaRanch!


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Ralf Rottmann
Greenhorn

Joined: Dec 07, 2003
Posts: 25
Why do you want the server side to initiate printing? Is there any specific reason that prevents you from doing it client side?


-----------------------------<br /><a href="http://www.rottmann.net" target="_blank" rel="nofollow">http://www.rottmann.net</a><p>"The real voyage of discovery consists not in making new landscapes but in having new eyes." <br />Marcel Proust (1871-1922)
Ray Kumar
Greenhorn

Joined: Jan 22, 2002
Posts: 17
well, I tried to create the pdf files at the client side, but generating pdf files (FOP) is really taking too much memory, so I swiched to server side. Our clients do not have enough RAM.

BTW, Any ideas on better PDF generator API's (free) especially with memory ?.
Thanks !!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: send data from servlet to printer