views:

366

answers:

1

In my application I can connect to a database and get an array resultset and using JSP code I can iterate through the array and can display the report in my webpage using HTML.

I want that the generated report in my HTML webpage can be exported in PDF format and saved in some .pdf file.

Please tell me how to implement such technique to implement such exporting technique.

A: 

You can use the PdfWriter class that comes with this package, which includes a quick tutorial from IBM on how to use it:

http://www.ibm.com/developerworks/opensource/library/os-javapdf/

Kristopher Ives
isn't there any method to pass the result set array and get a pdf report generated
Robin Agrahari
No, this doesn't make much sense. How would it know what to do with the `ResultSet`? Generate table? List? Images? Headers? Paragraphs? Formatting? Colors? Etcetera. If you really, really want to pass a plain vanilla ResultSet into some reporting tool "in a single code line", then your best report option is CSV, because it actually **makes sense**. If you want a PDF, you really need to format it **yourself** based on the `ResultSet`. In the time you're waiting for answers here you would already have been ready with help of Jasperreports tutorials.
BalusC