|
Fredrik,
Here
is the contents of my JSP so far...
<%
response.setContentType("application/pdf"); java.io.ByteArrayOutputStream buffer = new java.io.ByteArrayOutputStream(); com.lowagie.text.Document document = new com.lowagie.text.Document(); com.lowagie.text.pdf.PdfWriter writer = com.lowagie.text.pdf.PdfWriter.getInstance( document, buffer ); document.open(); document.add(new com.lowagie.text.Paragraph("Hello World")); document.close(); byte[] bytes = buffer.toByteArray(); response.setContentLength(bytes.length); for(int i = 0; i < bytes.length; i++) { out.write(bytes[i]); } %> Although when I write out to the screen, all I get
is....
%PDF-1.4 %???? 3 0 obj <> stream x?+?r ?26S?00SI?2P?5?1??
?B??4
I have
to use the "out" because for some reason when I forward to my JSP from a
servlet, if I then try to call response.getOutputStream() is throws an Illegal
State Exception saying that the getWriter has already been called. (I am
using JBoss 3.0.2/Tomcat 4.0.4) Is there any way that I use the write
method to display the file? Have you had any luck with that? I mean,
another way would be to prompt the user to download the file to their computer,
but then again, I had no luck with that as well. Anyways, thanks in
advance.
Daniel
|
Title: JSP, PDF, taglibs
- [iText-questions] JSP, PDF, taglibs Daniel Kalcevich
- Re: [iText-questions] JSP, PDF, taglibs Fredrik Nilsson
- Re: [iText-questions] JSP, PDF, taglibs Daniel Kalcevich
- Re: [iText-questions] JSP, PDF, taglibs Fredrik Nilsson
- RE: [iText-questions] JSP, PDF, taglibs Daniel Kalcevich
- Re: [iText-questions] JSP, PDF, taglibs Fredrik Nilsson
