tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Duffy <duff...@yahoo.com>
Subject Re: Pointing a ServerOutputStream at the printer? Possible?
Date Tue, 30 Sep 2003 16:37:19 GMT

The JSP output stream is HTML, of course, so your
printer would have to be smart enough to take HTML and
render it like a browser.  I think if you just send
the stream to a printer, all you'll get out is the
HTML text.

That aside, have a look at the javax.print API.  That
will let you send to a printer.  Maybe you can render
your data as a PDF or something else and then print
that. - MOD


--- Andoni <andoni@indigo.ie> wrote:
> Hi,
> 
> I want to have a print button on my site which
> prints the result of a JSP being processed.  What I
> don't want is for this JSP to have to be viewed by
> the user.  I could just bring the jsp up in another
> frame and then have the JavaScript print that frame.
>  What I would prefer is to have is something that
> the user clicks on and it streams (this word may be
> misleading here) the result of rendering the JSP to
> the printer.
> 
> I can do this so that it sends the text to a file
> using the 
> 
> ServletOutputStream myOs = res.getOutputStream()
> 
> and then using myOs.write(byte[]) to send data to a
> file but I don't know how to send the data to the
> printer.  Can you please help?
> 
> Kind regards,
> 
> Andoni.
> 
> PS: If anyone wants the code for the file version
> just let me know.
> A.


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

Mime
View raw message