When iText 5 was originally created, it was designed as a tool to produce PDF as fast as possible, flushing pages to the OutputStream as soon as they were finished. We'll take a closer look at this use case in chapter 4, converting XML to HTML in memory using XSLT, then converting that HTML to PDF using the pdfHTML add-on. They then populated the HTML with data, and used XML Worker to create the invoices as PDF documents, throwing away the original HTML. Rather than programming the design of an invoice in Java or C#, developers chose to create a simple HTML template defining the structure of the document, and some CSS defining the styles. A common use case was the creation of invoices. XML Worker expected predictable HTML created for the sole purpose of converting that HTML to PDF. We don't know of any implementations that used XML Worker for any other XML formats, but many developers used XML Worker in combination with jsoup as an HTML2PDF converter. A default implementation converted XHTML (data) and CSS (styles) to PDF, mapping HTML tags such as, , and to iText 5 objects such as Paragraph, Image, and ListItem. In 2011, iText Group released XML Worker as a generic XML to PDF tool, built on top of iText 5. To avoid this frustration, HTMLWorker was removed from recent versions of iText. This caused plenty of frustration because HTMLWorker didn't support every HTML tag, didn't parse CSS files, and so on. It was never meant to convert complete HTML pages to PDF, yet that was how many developers tried to use it. The goal of HTMLWorker was to convert small, simple HTML snippets to iText objects. The HTMLWorker class was deprecated many years ago. If that's the case, you've either been using the obsolete HTMLWorker class (iText 2), or the old XML Worker add-on (iText 5). If you've been working with iText in the past, you might remember the old HTML to PDF functionality.
If you're new to iText, please jump to chapter 1 immediately.
#ITEXT HTML TO PDF JAVA HOW TO#
In this tutorial, we'll learn how to convert HTML to PDF using pdfHTML, an add-on to iText 7. You can find a full list of features here. NOTE: We are continually updating our features- and have some new features that are not included in this eBook yet.