I'm using spring mvc with jsp. I want to give download to pdf functionality for an article which I see in the view rendered by the jsp. I want to have a same look and feel in the pdf as I have in the jsp view(without the header and footers ofcourse). What is the simplest and the best way to achive this functionality? I'm aware that I can use itext library for AbstractPdf view but that would mean I need to create cell and table. Is there any easier way to do that? Thanks.
Asked
Active
Viewed 1,310 times
1 Answers
0
When I remember right, then iText has a way to render HTML.
So what you need to do, is create the HTML content without header and footer, and then put this in iText.
HTML to PDF: @see Using itext to convert HTML to PDF
JSP to String: @see rendering JSP to a string
-
Thanks, but how can I get the html from jsp? I'm returning modelAndView from my controller. – tintin Oct 20 '11 at 15:17
-
I have added a link the a stack overflow question that discuss that theme. – Ralph Oct 20 '11 at 15:41