How to convert HTML code to a PDF file in java?

3

I'm developing an application where I need to convert an HTML code, which is saved in the database, to a .PDF file. There is no need to save this file to the server.

I've never done anything similar. How to do this using Java?

    
asked by anonymous 09.08.2015 / 05:29

1 answer

1

I do exactly that in an application developed with the Grails framework. I use a plugin called Rendering which, in turn, uses a Java library called Flying Saucer . I could post an example in Grails, but I do not think it would help you much since you're working with Java.

The Flying Saucer uses a library called iText. This is the library that effectively transforms an XHTML into a PDF. There are some licensing issues that need to be verified.

A response in the SOen where the same thing is recommended.

    
09.08.2015 / 13:09