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

Asked

Viewed 493 times

3

I am developing an application where I need to convert an HTML code, which is saved in the database, into a .PDF. file.No need to save this file to the server.

I’ve never done anything like this. How to do this using Java?

  • Put a snippet of code from what you’ve already done! You’re using java web?

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 don’t think it would help you much, since you are working with Java.

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

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.