Ef Ge Ef Ge - 1 year ago 63
PHP Question

Create PDF/a-3 invoices

I am using tcpdf to generate invoices in the pdf/a1-b format. As far as I know is there no possibility to generate pdf-a3 with tcpdf.
Is there any possibility to convert pdf/a-1b to pdf/a-3? Is it just generating an invoice.xml file and append it to my invoice.pdf?

Answer Source

Take a look at my slides ZUGFeRD: an overview and you'll notice that you can't just use any invoice.xml. Although a PDF/A-1b file also conforms to PDF/A-3b, you can't just append the XML file as an attachment.

You need to name the XML file ZUGFeRD-invoice.xml (not invoice.xml) and add this XML as an associated file (/AF) to the defining the relationship as Alternative. You also need to tell the PDF which level of ZUGFeRD you're conforming to (basic, comfort, extended). This is done in the XMP stream (the same place where you define a file as PDF/A-3).

I am not aware of any PHP libraries that is advanced enough to achieve this. The concept of associated files is rather new, and ZUGFeRD was only introduced in 2014 in Germany. The English translation of the spec dates from January 2015. It would surprise me if the popular PHP libraries for PDF already know about ZUGFeRD.