Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: How can I generate a PDF file from a JSP JSF page?

I need to generate a PDF from a JSP JSF page. I have searched the net, but I didn't found any examples of how should I do this. I need to transform the whole page, or maybe only the charts that I have on that page.

P.S. I'm also using IceFaces.

like image 847
user239161 Avatar asked Dec 27 '09 13:12

user239161


2 Answers

The easiest way is probably to capture the HTML using a Filter and convert that to PDF using a suitable API, then return the application/pdf data from the Filter. The IceFaces partial-submit support can probably be used to capture a subset of the component tree output, but you'll probably have to study the details of the IceFaces HTTP requests to figure out how to leverage that.

like image 132
McDowell Avatar answered Sep 21 '22 04:09

McDowell


As far as I know this isn't directly possible. You can use Jasper Reports to generate a pdf on the server side. Or, you can use PrintPDF which is a firefox plugin to create one from the web browser.

like image 26
Mark Pope Avatar answered Sep 21 '22 04:09

Mark Pope