Tags: ZUGFeRDZUGFeRD examples
ZUGFeRD e-book v2
With the release of iText 7, some part of the first edition of the book "ZUGFeRD: The Future of Invoicing" became obsolete. In the meantime, we have been busy updating the content to iText 7 code and including new add-ons such as pdfHTML. Today, ZUGFeRD is still a very important standard for invoicing, that makes processing invoices much easier by combining EDI standards (Electronic Data Interchange, e.g. Cross Industry Invoice or CII) with the PDF/A-3 standard. The human-oriented representation using PDF and the machine-oriented EDI information stored within the PDF are the key strengths of...


I started this tutorial by explaining that I'm not always happy when I receive an invoice.

In the first chapter of this book, I explained the issues I have with many invoices:

  • They aren't future proof,

  • They aren't accessible,

  • Either they can be read by humans but not by machines,

  • or the can be read by machines but not by humans.


7. Creating PDF invoices (Comfort)

iText 7 is a PDF library with several add-ons, one of which is called pdfHTML. The pdfHTML add-on is a powerful HTML to PDF conversion tool. It takes an HTML or HTML5 file, and converts it to PDF, taking into account CSS and media queries. Incidentally, we have just created a batch of invoices in the HTML format. I wonder if we could convert those to ZUGFeRD invoices...

Tags: ZUGFeRDXHTMLInvoicesiText 5
This example was written in the context of chapter 6 of the book ZUGFeRD: The Future of Invoicing .

6. Creating HTML invoices

Please allow me to introduce a short intermezzo. The ZUGFeRD standard doesn't discuss HTML anywhere, yet I think it's useful to dedicate a chapter to the creating of HTML based on the ZUGFeRD data model. In the next chapter, you'll discover why.

An XSL for Comfort XMLs

As explained in chapter 5, the XMLs created to comply with the Basic profile don't contain sufficient information to create the visual appearance of the corresponding invoice. The XML doesn't contain all the information that is needed if we want to render the line items.


5. Creating PDF invoices (Basic profile)

To create a ZUGFeRD invoice, we now have to combine what we've learned in chapter 2 "Creating PDF/A files with iText" with what we've learned in chapter 4 "Creating XML Invoices with iText".

Creating PDF from scratch

In this chapter, we'll discuss a single example: PdfInvoicesBasic. In this example we'll create a PDF document for every invoice stored in our database. The PDF documents will be ZUGFeRD invoices using the Basic profile.