I'm looking a free library for commercial use that allows me to generate PDF (from code) and add a HTML text (from HTML editor java-fx).

I created my app on itext 7 and it works good but I have to pay for licence or use it under AGPL so I have to publish all my code. I tried also use itext 5 but when I want to generate 70-page PDF it takes too much time.

3 Answers 3


wkhtmltopdf is a decent free solution to translate html to pdf, it is based on webkit’s pdf renderer.

wkhtmltopdf and wkhtmltoimage are open source (LGPLv3) command line tools to render HTML into PDF and various image formats using the Qt WebKit rendering engine. These run entirely "headless" and do not require a display or display service.

There is also a C library, if you're into that kind of thing.

There are plenty of command line options. Check out the auto-generated wkhtmltopdf manual.

  • 1
    Welcome aboard Emily. I hope you don't mind that I took the liberty of editting your answer to provide some more information. just that first line, with no link, wasn't so helpful, especially as you didn't mention the library. In general, answers should explain how they answer the question, point for point, if necessary. I hope this doesn't sound harsh - it certainly isn't meant to be - just a pointer to helping others. Welcome aboard; we look forward to your participation here. And +1 for what looks like a good answer
    – Mawg
    Commented Jan 18, 2018 at 7:36

WeasyPrint is a BSD-licensed library that converts HTML to PDF. It is written in Python, but you didn't mention whether you absolutely need the library to be in Java. Maybe you can run it from your app using Jython.


Apache PDFBox® - A Java PDF Library

The Apache PDFBox® library is an open source Java tool for working with PDF documents. This project allows creation of new PDF documents, manipulation of existing documents and the ability to extract content from documents. Apache PDFBox also includes several command-line utilities. Apache PDFBox is published under the Apache License v2.0.

I don't know about inserting HTML content, but otherwise this seems to fit your criteria.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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