ZUGFeRD / Factur-X Electronic Invoices |
ZUGFeRD (Germany) and Factur-X (France) are the same European standard for hybrid electronic invoices: a PDF/A-3 document that people read, with the invoice data embedded as XML (EN 16931, Cross Industry Invoice) that accounting software reads. Render the invoice from HTML, add the XML with AddZugferdInvoice, and save.
PdfConverter converter = new PdfConverter(); // a ZUGFeRD invoice is a PDF/A-3 document converter.PdfStandardSubset = PdfStandardSubset.Pdf_A_3b; converter.PdfDocumentInfo.Title = "Invoice INV-2026-0042"; // the readable invoice, rendered from your invoice page or template using (Document document = converter.GetPdfDocumentObjectFromHtmlString(invoiceHtml)) { // the machine-readable invoice: the Factur-X / ZUGFeRD XML of the same invoice // (EN 16931 profile) document.AddZugferdInvoice("factur-x.xml", ZugferdProfile.En16931, AttachmentRelationship.Alternative); document.Save("INV-2026-0042.pdf"); }
The XML must describe the same invoice the PDF shows; ExpertPdf embeds it and writes the metadata, it does not create or validate the XML. Generate it with your accounting or invoicing software, or with a library for the Cross Industry Invoice format.
Parameter | Values |
|---|---|
The profile of the XML: Minimum, BasicWL, Basic, En16931 (the full European standard, the usual choice), Extended, XRechnung (the German public sector; the embedded file is named xrechnung.xml). | |
Alternative (the XML is another form of the invoice - the usual value), Data or Source. | |
ZugferdSchema (optional) | FacturX10 (the default: Factur-X 1.0 / ZUGFeRD 2.1+, file factur-x.xml) or Zugferd20 (ZUGFeRD 2.0, file zugferd-invoice.xml). |
The document must be PDF/A-3: Pdf_A_3b, Pdf_A_3u, or Pdf_A_3a for an invoice that is also accessible (tagging is turned on by that level; set AccessibilityStandard to Pdf_UA_1 to declare PDF/UA as well - see Tagged PDF). A document of another level is refused. An existing PDF invoice can be made one: load it into a Document, convert it with ConvertToPdfA(PdfStandardSubset) to Pdf_A_3b, then add the XML. The XML can also be given as a stream; it is read when the method is called.