ZUGFeRD and Factur-X

The ZUGFeRD and Factur-X Formats for electronic Invoices

On this page we describe the ZUGFeRD format for electronic invoices. 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«. The organisation responsible for Factur-X is FNFE-MPE (»Forum National de la Facture Electronique et des Marchés Publics Electroniques«).

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.

ZUGFeRD 1.0 has been published as German national standard. ZUGFeRD 2.0 and its sibling Factur-X target electronic invoicing in all EU countries.

ZUGFeRD 1, ZUGFeRD 2 and Factur-X

The ZUGFeRD 1.0 specification has been published in June 2014. The ZUGFeRD 1.0 info package (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 2.0 has been published in March 2019. It is based on European Norm EN 16931 from June 2017, conforms to the XRechnung standard and is compatible with the corresponding French standard Factur-X.

ZUGFeRD 1.0 und 2.0 apply the same principles regarding embedding in PDF/A. Minor differences are mentioned in the description 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 2.0 and Factur-X are based on UN/CEFACT Cross Industry Invoice Stand D16B version 100, uncoupled set of schemas (CII). Since ZUGFeRD 1.0 uses a custom XML flavor, the invoice XML slightly differs between both versions. For example, the root element in ZUGFeRD 1.0 is CrossIndustryDocument, but CrossIndustryInvoice in ZUGFeRD 2.0/Factur-X.

ZUGFeRD 1.0 and 2.0/Factur-X support multiple application profiles:

  • ZUGFeRD 2.0 only: the »Minimum« and »Basic WL« profiles have been included in ZUGFeRD 2.0 for compatibility with the French standard Factur-X. They don't contain all invoicing information required in Germany and should therefore not be used in Germany.
  • The »Basic« profile carries structured data for simple invoices. Additional information can be included as free text. It covers only a subset of EN 16931-1 and is suitable for simple invoices.
  • The »Comfort« profile adds structured data for fully automated invoice processing. It completely covers EN 16931-1.
  • The »Extended« profile adds still more structured data for exchanging invoice across different industry segments.

At a minimum, 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 a fixed file name for the XML attachment; however, the standards require slightly different file names:

  • ZUGFeRD 1.0: file name "ZUGFeRD-invoice.xml"
  • ZUGFeRD 2.0: file name "zugferd-invoice.xml"
  • Factur-X: file name "factur-x.xml"

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; the version of the corresponding XML schema; 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. Templates for the XMP metadata properties for ZUGFeRD 1.0, ZUGFeRD 2.0 and Factur-X including the required PDF/A extension schema description can be found at the end of this page. The templates for the three standards are slightly different because different file names are required for the XML attachments (see (2) above) and different XML namespaces and prefixes are used.

Validating ZUGFeRD and Factur-X Invoices

ZUGFeRD and Factur-X 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 according to ZUGFeRD 1.0, ZUGFeRD 2.0 or Factur-X can be checked with the sample program zugferd_retrieve_XML in the pCOS Cookbook. This program extracts the XML representation of the invoice.
  • The extracted XML invoice can be checked for formal validity with an XML schema validator. The required XSD/Schematron schema files are included in the ZUGFeRD/Factur-X packages. The ZUGFeRD 1.0 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.
  • A ZUGFeRD 1 validator is available at https://www.din-zugferd-validation.org (free, but requires registration)
  • The open source validator ZUV (ZUGFeRD+VeraPDF) checks for PDF/A-3 conformance with veraPDF as well as XML validity according to ZUGFeRD 1.0 and ZUGFeRD 2.0 with EN16931 profile using the respective Schematron files. It is available online at https://www.zugferd-community.net/de/open_community/validation (requires registration).
    Note that we detected several inconsistencies between the ZUGFeRD 2.0 specification, the sample invoices which are included in the packages and the online validator. We reported these problems to FeRD.

PDF Processing for ZUGFeRD and Factur-X

Organizations can implement ZUGFeRD or Factur-X invoices using one or more of the following PDF processing elements:

  • Create a PDF/A-3 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 invoice
  • Extract invoice XML from an existing PDF/A-3 invoice

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

Implementing digital invoices with PDFlib

PDFlib 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 and Factur-X Invoices

The ZUGFeRD and Factur-X info packages include sample PDF/A-3 invoices which demonstrate various scenarios. In addition we make available ZUGFeRD and Factur-X sample invoices for download. They have been created with PDFlib and the code presented in the PDFlib Cookbook. The samples use the »Basic« profile:

ZUGFeRD 1.0 sample invoice

ZUGFeRD 2.0 sample invoice

Factur-X sample invoice