pdfwriter
This project provides 2 ways of creating pdfs:
Manual Creation
You can create a pdf file from scratch by using OpenPDF which is a fork of iText. The fork is under commercially friendly open source libraries. Newer versions of iText are under AGPL if you don't pay for a commercial license and AGPL should be avoided if you don't want to publish all your source code.
See https://github.com/LibrePDF/OpenPDF.
Creation from HTML
Further this projects includes a simple example of how to create pdfs from html files by using flying-saucer-pdf-openpdf.