Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am developing a JSF project and I have a doubt about reporting.

The idea is to offer the users reports in both HTML and PDF formats.

This should work developing the reports in HTML+CSS+JS and whenever a user needs a PDF report just convert the HMTL+CSS+JS to PDF.

Does somebody know a free Java library for converting the HTML to PDF? This should be blind to the user.

Other proposals are accepted.

Thanks in advance.

share|improve this question

5 Answers 5

up vote 5 down vote accepted

better to use wkhtmltopdf tool to convert your HTML to pdf

share|improve this answer
    
I have tried with wkhtmltopdf but i am getting troubles since it does process the CSS but not the JS. Is there any way of process the JS before the PDF is created? –  antonio_Developer Nov 20 '13 at 9:16
    
Finally I opted for using pure HTML/CSS graphs and wkhtmltopdf. Thanks for the solution –  antonio_Developer Nov 20 '13 at 10:32

Apache FOP would be one solution which is an XSLT based solution although it does not support HTML5. Flying Saucer, wkhtmltopdf are some free solutions which are worthy a try. Commercial libraries like PriceXML offer support to CSS3. Pdfcrowd is yet another commercial solution.

share|improve this answer

Would Jasper Reports be an option? From the same report file you can generate many formats, PDF and HTML (+CSS) are two of them. Plus there is a GUI report designer.

share|improve this answer

Free solution: wkhtmltopdf - uses WebKit under the hood.

Commercial solution: PrinceXML - uses it's own ACID 2 compliant HTML rendering engine.

share|improve this answer

Try out Flying Saucer

It internally uses iText and pretty good library

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.