ZUGFeRD invoices

The German ZUGFeRD Format for electronic Invoices

On this page we describe the ZUGFeRD format for electronic invoices in Germany. The name ZUGFeRD (pronounced »Tsoogfaird«) is a pun on the German word »Zugpferd« which means »draft horse«. It indicates that the new invoicing standard is positioned to play a major role regarding efficient electronic invoicing. ZUGFeRD allows the exchange of invoices between supplier and payer without any requirements for prior arrangements. ZUGFeRD invoices can be deployed universally and are not limited to specific industry sectors or company sizes. Private enterprises as well as public administration can efficiently organize their invoice processing with ZUGFeRD.

The standard has been created by a working group which comprises members from the public administration, three German federal ministries, industry associations in the financial, tax and software sectors, and other organizations. The working group is called »Forum elektronische Rechnung Deutschland» (FeRD) which means »Forum for electronic invoices Germany«.

ZUGFeRD is abbreviated for »Zentraler User Guide des Forum elektronische Rechnung Deutschland«. The goal of ZUGFeRD is to enable electronic invoice exchange including structured data in the public and private sectors. However, unlike existing standards like EDI it is not only targeted at large organizations, but also small and medium-sized businesses as well as freelancers. ZUGFeRD invoices do not require prior arrangements between sender and receiver and are not specific to any particular industry sector.

It is planned to create a German national standard (DIN) based on ZUGFeRD. Looking forward it is desired to introduce a new work item for creating a European standard (CEN).


After one year of development and fine-tuning with »Release Candidates« the ZUGFeRD 1.0 specification has been published in June 2014. The ZUGFeRD info package (currently available only in German language) contains specifications, XML schemas, XSLT style sheets as well as a dozen of sample PDF invoices. The PDF-specific requirements of the ZUGFeRD format are summarized below.

ZUGFeRD Design

ZUGFeRD invoices carry both a human-readable representation (rendering) of the invoice as well as a structured machine-readable XML representation. The human-readable rendering is encoded as one or more PDF pages according to the PDF/A standard. You can find more information about PDF/A here. The XML representation is not a completely new format, but is based on existing international standards. In order to associate both invoice renderings with each other, ZUGFeRD leverages an important feature of PDF/A-3 (ISO 19005-3) which allows to embed attachments of arbitrary types into the PDF/A document. The XML invoice data is embedded in the PDF document as an attachment according to PDF/A-3 (also called associated file). In other words, ZUGFeRD invoices contain two separate renderings of the invoice where PDF/A-3 serves both as one of the renderings as well as the container for the XML rendering.

XML Part of a ZUGFeRD Invoice

While we will focus on the PDF aspects of ZUGFeRD on the remainder of this page, here is a brief overview of the embedded invoice XML. ZUGFeRD does not introduce a new XML format for invoices, but instead is based on the existing standard »Core Cross Industry Invoice« (CII) developed by UN/CEFACT. The CII provides a large framework with more than 2000 elements. The framework is modelled around business processes and relationships. Customarily the CII framework is restricted for particular applications because usually not all elements are required.

ZUGFeRD supports three profiles which comprise different CII subsets which are not specific to particular industry segments:

  • The »Basic« profile carries structured data for simple invoices. Additional information can be included as free text.
  • The »Comfort« profile adds structured data for fully automated invoice processing.
  • The »Extended« profile adds still more structured data for exchanging invoice across different industry segments.

At a minimum, ZUGFeRD applications must support the »Basic« profile, but they may add more CII elements provided these don’t interfere with the »Extended« profile. Since additional elements are outside the scope of ZUGFeRD they require prior arrangements between the exchanging parties.

PDF Requirements for ZUGFeRD Invoices

The ZUGFeRD format specification spells out the following requirements in section 7 »Embedding in a PDF/A-3 file«:

(1) The PDF part of a ZUGFeRD invoice must conform to the PDF/A-3 standard (ISO 19005-3). All PDF/A-3 conformance levels are allowed, i.e. PDF/A-3a, PDF/A-3b, and PDF/A-3u. It simultaneously serves as container for the XML part. While only a single XML invoice attachment is allowed in ZUGFeRD, additional attachments for other purposes may also be embedded. For example, spreadsheets, CAD drawings, images or other files can be embedded which are related to the invoice or may be relevant for invoice verification.

While only PDF/A-3 allows embedded file attachments, the three PDF/A levels are upwards compatible regarding the use of PDF elements. This implies the following combinations for creating ZUGFeRD invoices by attaching XML to PDF/A invoices:

  • PDF/A-1a and PDF/A-2a can serve as basis for PDF/A-3a, PDF/A-3b or PDF/A-3u;
  • PDF/A-1b and PDF/A-2b can serve as basis for PDF/A-3b;
  • PDF/A-2u can serve as basis for PDF/A-3b or PDF/A-3u;

(2) The XML part of the invoice must be associated with the document level of the PDF/A document (as opposed to some part of it, e.g. a page). In PDF/A-3 this is expressed with the /AF(associated files) key in the document catalog. It is required to use the file name ZUGFeRD-invoice.xml for the XML attachment. The relationship of attachment and document must be »Alternative« to signal that the PDF and XML representations are equivalent. In PDF/A-3 this is expressed with the /AFRelationship key.

(3) The XML file must additionally be declared as regular PDF attachment so that it can be processed with tools which don’t support associated files according to PDF/A-3 (such as Acrobat XI). This is achieved by including the attachment in the PDF 1.7 standard data structure /EmbeddedFiles in the document catalog.

(4) The XMP document metadata must include four entries from the ZUGFeRD schema. These entries describe the document type (always INVOICE); the file name of the embedded XML representation which must match the name under which the XML is actually attached in the PDF document (always ZUGFeRD-invoice.xml); the version of the corresponding XML schema (currently 1.0); and the name of the applicable ZUGFeRD profile (BASIC, COMFORT, or EXTENDED). PDF/A requires that custom metadata properties like those defined by ZUGFeRD are accompanied by the corresponding schema description or extension schema; see here for details. Note that the XMP extension schema requirements are identical in PDF/A-1, PDF/A-2 and PDF/A-3. A template for the XMP metadata properties for ZUGFeRD including the required PDF/A extension schema description can be found here.

Validating ZUGFeRD Invoices

ZUGFeRD invoices can be validated as follows:

  • Conformance to the PDF/A-3 standard can be checked with one of the available PDF/A-3 validators. For example, the Preflight function in Acrobat XI and above includes PDF/A-3 validation. This process also checks the required XMP Extension Schema
  • Correct embeddding of the XML file can be checked with the sample program zugferd_retrieve_XML in the pCOS Cookbook. This program extracts the ZUGFeRD XML representation of the invoice.
  • The extracted XML invoice can be checked for formal validity with an XML schema validator. The required XSD schema files are included in the ZUGFeRD info package. The ZUGFeRD info package also contains a style sheet for visualizing the XML invoice data with HTML (the style sheet requires a processor with support for XSLT 2.0). This allows for rendering the invoice contents independently from the PDF rendering, which can be used for checking or representation in an HTML browser.
  • Dedicated ZUGFeRD validators are also available, e.g. at https://www.din-zugferd-validation.org.

PDF Processing Steps for ZUGFeRD

Organizations can implement ZUGFeRD invoices using one or more of the following PDF processing steps:

  • Create a PDF/A-3 ZUGFeRD invoice with embedded invoice XML from scratch
  • Add invoice XML to an existing PDF/A-1 or PDF/A-2 document to create a PDF/A-3 ZUGFeRD invoice
  • Extract invoice XML from an existing PDF/A-3 ZUGFeRD invoice

These PDF processing steps can be implemented with PDFlib products. This is discussed in more detail below.

Implementing ZUGFeRD with PDFlib 9

PDFlib 9 fully supports the PDF/A-1/2/3 standards and can be used to implement the ZUGFeRD format. All three PDF processing steps above are supported. The ZUGFeRD requirements above can be met with suitable PDFlib API options.

PDF/A-3 standard conformance can be requested with the pdfa option of begin_document(). The required XMP metadata can be supplied with the metadata option:

if (p.begin_document(outfile,
    "pdfa=PDF/A-3b metadata={filename={" + xmpfile + "}}") == -1)

Since the invoice XML is created dynamically we recommend to use the PDFlib Virtual Filesystem (PVF) to create an in-memory file which contains the XML stream for the invoice. This PVF file must be loaded as an asset which is embedded as file attachment as required by ZUGFeRD. The option documentattachment ensures that it will also be visible in PDF viewers which don’t support associated files according to PDF/A-3 (in other words: the XML file can also be extracted with Acrobat):

// Place XML stream in a virtual PVF file
String pvf_name = "/pvf/ZUGFeRD-invoice.xml";
byte[] xml_bytes = xml_string.getBytes("UTF-8");
p.create_pvf(pvf_name, xml_bytes, "");

// Create file attachment (asset) from PVF file
int xml_asset = p.load_asset("Attachment", pvf_name,
     "mimetype=text/xml description={ZUGFeRD invoice in XML format} "
   + "relationship=Alternative documentattachment=true");

// Associate file attachment with the document
p.end_document("associatedfiles={" + xml_asset + "}");

ZUGFeRD Topics in the PDFlib Cookbook

The PDFlib and pCOS Cookbooks contain full sample code for the PDF processing steps described above:

Sample ZUGFeRD Invoices

The ZUGFeRD info package provided by FeRD includes several sample PDF/A-3 invoices. In addition we make available a ZUGFeRD invoice for demonstration purposes. This invoice has been created with PDFlib 9 and the code presented in the PDFlib Cookbook.


ZUGFeRD info package including format specification

The following XMP file contains the required ZUGFeRD extension schema description for PDF/A. It can be used to create ZUGFeRD invoices with PDFlib or other software:
XMP metadata for ZUGFeRD with PDF/A-3 extension schema

TechNote 0009 explains the construction of an XMP extension schema which is required for the ZUGFeRD metadata

PDFlib and pCOS Cookbook samples for ZUGFeRD: