Example of a portlet that writes pdfs using iText and Freemarker (it includes all it's dependencies).
A Freemarker template (template.ftl) is used to generate an HTML that will be passed to iText who will finally render the PDF.
Example of PDF generated by this portlet: https://github.com/roclas/pdfUtil/blob/master/example_result.pdf
Just press the button and the PDF will be generated