Do we need a browser engine to render HTML+CSS to PDF

Similar questions were posted on Stack Overflow on May 23, '13 by Kaha and on Aug 14, '17 by Srinivas Ch

No, pdfHTML does all the work parsing the HTML and CSS, and mapping them to iText objects and styles. Then the iText engine renders the PDF based on these objects and styles.

However, pdfHTML doesn't support SVG for now, nor does it evaluate JavaScript. Support for SVG is on the development roadmap, and you could solve the JavaScript problem by using a browser engine to preprocess the HTML+CSS+JS. Examples of such a browser engine are WebKit (Chrome, Safari) and Gecko (Firefox). These can interpret the JavaScript and give you HTML that can be rendered by pdfHTML.



Ready to use iText?

Try our iText 7 Library and add-ons FREE for 30 days. Test your proof of concept, and see if our solution is right for you.

Get my FREE trial
Contact

Still have questions? 

We're happy to answer your questions. Reach out to us and we'll get back to you shortly.

Contact us
Stay updated

Join 11,000+ subscribers and become an iText PDF expert by staying up to date with our new products, updates, tips, technical solutions and happenings.

Subscribe Now