Generating a pdf from JSP

HiI have some front end design of a report in jsp...it has tables and images. Is it possible that the response can be sent as a pdf file.....
[155 byte] By [prasadkrn83a] at [2007-11-27 8:10:11]
# 1
You will have to use some sort of converstion tool that takes you html response an converts it into a pdf. We use pd4ml. It's pretty fast and does a good job. There are other free ones out there but none of them could handle our complex reports.
tadchristiansena at 2007-7-12 19:53:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Once you have your pdf generated do the following:

byte[] buffer = new byte[(int) pdfReport.length()];

InputStream fis = pdfReport.getInputStream();

fis.read(buffer);

fis.close();

response.setContentType("application/pdf");

response.setHeader("Content-disposition","inline; filename=report.pdf");

response.setContentLength(buffer.length);

OutputStream output = response.getOutputStream();

output.write(buffer);

output.flush();

Sorry I may have misunderstood you the first time. This is probably what you were looking for.

tadchristiansena at 2007-7-12 19:53:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Your first reply was more informative...... but pd4ml is not a free software....is there any free API's to achive the same?Message was edited by: prasadkrn83
prasadkrn83a at 2007-7-12 19:53:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

There are a bunch of different PDF-generation libraries[1], under various licenses. Of these, I've only tried the Apache FOP[2] one, but iText[3] looks pretty good.

[1] http://schmidt.devlib.org/java/libraries-pdf.html

[2] http://xmlgraphics.apache.org/fop/index.html

[3] http://www.lowagie.com/iText/

glennjia at 2007-7-12 19:53:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
one word: iText :)
mokopaa at 2007-7-12 19:53:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...