A year and a half after the release of iText 7 - a rewrite of iText from scratch, many developers have migrated from iText 5 to iText 7. We've received feedback that:
the new API is much more intuitive;
iText 7 code is much easier to write, read, and maintain;
the upgrade was postponed because of:
lack of time, and
the effort needed to rewrite application due to the fact that iText 7 isn't backwards compatible.
Surprisingly, not many developers have made the switch from iText 5 + XML Worker to iText 7 + the pdfHTML add-on yet. When asked why not, developers gave us different answers:
There is not enough online documentation about the pdfHTML add-on,
the pdfHTML add-on is closed source,
the pdfHTML add-on is only released on iText servers, not on GitHub or Central (Maven), and
developers don't know where to download it.
We have taken these questions to heart, and made a couple of decisions that will make many developers happy. To find out more, continue reading this blogpost.
We have released a 125-page tutorial about pdfHTML: "iText 7: converting HTML to PDF with pdfHTML." With this tutorial, we answered the #1 question of the developers who responded to our survey: the request for more documentation.
This tutorial consists of 7 chapters:
Chapter 1: Hello HTML to PDF: consists of a series "Hello World" examples that explain the different approaches to convert HTML to PDF with the pdfHTML add-on,
Chapter 2: Defining Styles with CSS: explains the different approaches to use CSS to define styles for HTML... and PDF,
Chapter 3: Generating PDF based on Media Queries: demonstrates how a single HTML file can result in different PDF documents depending on Media Queries,
Chapter 4: Creating reports using pdfHTML: shows how data can be rendered to PDF using HTML and CSS to define the layout, and shares some best practices for creation industry-grade, future-proof reports, invoices, catalogues,... involving standards such as PDF/A and PDF/UA.
Chapter 5: Custom tag workers and CSS appliers: reveals how you can change the inner workings of pdfHTML and how to adapt the way HTML tags and CSS styles to your own needs,
Chapter 6: Using fonts in pdfHTML: talks about fonts, fonts, and fonts, listing the different types of fonts that are supported, how to select fonts, how to use a different encoding, and how to create international documents (with content in Russian, Greek, Hebrew, Arabic, and many other languages),
Chapter 7: Frequently Asked Questions about pdfHTML: reuses a dozen of questions that were posted in the past about XML Worker, for which we now provide an answer using iText 7 and pdfHTML.
If you are interested in pdfHTML, read our new tutorial on the iText here.
During the process of making examples for this book, several bugs were discovered, and some ideas for new features emerged. Bugs were fixed, and new functionality was added, but... these will only be available in the next version. Developers who already want to experiment with the examples from the tutorial require early access to intermediate versions that aren't officially released yet. This is easy to achieve with the SNAPSHOT builds of our latest development version that we constantly publish to our Artifactory server, which also acts as a Maven repository.
On top of that, we've decided to make pdfHTML (and other add-ons: pdfSweep, pdfInvoice and pdfDebug) open source, under the AGPL license like iText Core, answering request #2 from our community of developers. We believe there's a lot of value in this for developers in general. They will be able to develop proof of concepts and projects quicker, having the source code available to inspect or improve in case they hit a problem. For the open source community in particular, we want to enable them to build on top of our add-ons and integrate them easily into their open source projects. We hope that the feedback and improvements that will result from these projects will be shared, in order to benefit other developers and iText implementations.
The open source version of pdfHTML is available on GitHub and Central (Maven), meeting request #3:
<dependency> <groupId>com.itextpdf</groupId> <artifactId>html2pdf</artifactId> <version>1.0.2-SNAPSHOT</version> </dependency>
The pdfHTML add-on can also be downloaded (request #4) and more details on how to download can be found here. Hereby meeting the #4 question of the developers who responded to our survey.
In case you would have remarks, questions or other feedback, please let us know.