Skip to main content
All docs
V26.1
  • PDF Document API (New): Create a ZUGFeRD-Compliant PDF Invoices

    • 2 minutes to read

    ZUGFeRD (Zentraler User Guide des Forums elektronische Rechnung Deutschland) is a standard for electronic invoices in Germany. It combines a PDF/A-3 file with an embedded XML file containing the invoice data.

    The PDF Document API (New) allows you to create ZUGFeRD-compliant PDF invoices. The following versions are supported:

    Version Description
    Version1_0 Original ZUGFeRD 1.0 format
    Version2_0_1 ZUGFeRD 2.0.1+
    Version2_1 ZUGFeRD 2.1+ (compatible with v2.1, v2.1.1, v2.2, and v2.3)
    Version2_3_2 ZUGFeRD 2.3+ (compatible with v2.3.2, v2.3.3 and v.2.4)

    Call the PdfDocument.AttachZugferdInvoice method to create a ZUGFeRD-compliant PDF invoice. You can load the invoice data from an XML file or a stream. The method also allows you to specify the ZUGFeRD version and the PDF/A-3 compliance level.

    PDF Document API (New) supports the following ZUGFeRD conformance levels:

    • Minimal: The PDF/A-3 file contains the XML invoice data and includes only the minimum required metadata to identify the invoice.
    • Basic: The PDF/A-3 file contains the XML invoice data, but does not include any additional metadata or structure.
    • BasicWL: The PDF/A-3 file contains the XML invoice data and includes additional metadata to improve the readability of the invoice.
    • Comfort: The PDF/A-3 file contains the XML invoice data and includes additional metadata and structure to improve the readability and usability of the invoice.
    • Extended: The PDF/A-3 file contains the XML invoice data and includes additional metadata and structure to improve the readability, usability, and interoperability of the invoice.
    • EN16931: The PDF/A-3 file contains the XML invoice data and includes additional metadata and structure to comply with the EN 16931 standard for electronic invoicing in Europe.
    • XRechnung: The PDF/A-3 file contains the XML invoice data and includes additional metadata and structure to comply with the XRechnung standard for electronic invoicing in Germany.

    The following code snippet attaches a ZUGFeRD invoice to an existing PDF document and saves the result as a new file:

    using DevExpress.Docs.Pdf;
    using System.IO;
    
    using (PdfDocument pdfDocument =
        new PdfDocument(File.OpenRead(@"document_001.pdf")))
    {
        pdfDocument.AttachZugferdInvoice(File.ReadAllBytes("ZUGFeRD-invoice.xml"), ZugferdVersion.Version2_3_2, ZugferdConformanceLevel.Basic);
    
        pdfDocument.Save(File.Create("document_001_attached.pdf"));
    }