It is now also possible to create ZUGFeRD invoices with DynaPDF. ZUGFeRD is a German invoice format that based on PDF/A 3. The ZUGFeRD format should simplify and standardize the exchange of invoices between companies and governments.
ZUGFeRD invoices consist of a PDF/A 3 compliant PDF file and an XML invoice that was attached to the PDF file. The PDF file represents the visual representation while the XML version is intended for electronic processing. The XML and PDF file have a well defined structure, therefore an electronic processing is very easy.
From the view of DynaPDF a ZUGFeRD invoice is just a normal PDF/A 3 file that has an XML file attached. Since layers and transparency are both allowed, the creation of such files is relatively unproblematic. There is not much that must be considered, except the name of the embedded XML invoice. This file name must be set to ZUGFeRD-invoice.xml (case-sensitive).
The XML invoice is probably directly attached from memory with AttachFileEx() in most cases. Therefore, the parameter FileName must be set to "ZUGFeRD-invoice.xml". In PDF/A 3 it is not allowed to attach a file without assigning it with a PDF object. This can be done with AssociateEmbFile(). The parameter DestObject must be set to adCatalog and RelationShip must be set to arAlternative.
Finally the PDF version must be set to the wished output format, e.g. to pvZUGFeRD_Basic, finished!
Invoices are very often created from PDF templates and whenever an existing file will be edited it is not known whether the resulting PDF file will conform to PDF/A. For this purpose CheckConformance() of the PDF/A Extension is available. The function can convert arbitrary PDF files to PDF/A 1b, 2b, 3b, and into the ZUGFeRD format.
CheckConformance() can also be called for completely new created PDF files. In this way, the correct settings can be easily found or checked. If everything is correct, CheckConformance() needs no longer to be called.