European E-Invoicing Guide: Generating Factur-X & ZUGFeRD Hybrid PDFs with Embedded XML
A complete developer tutorial on generating legally compliant European hybrid e-invoices conforming to EN 16931 / Factur-X / ZUGFeRD 2.2 with embedded XML via API.
By 2026, electronic B2B invoicing mandates across the European Union (EU Directive 2014/55/EU, Germany's Wachstumschancengesetz, France's Facturation Γlectronique, and Denmark's updated Bookkeeping Act) make it compulsory for businesses to issue invoices in standardized, machine-readable formats. Sending a standard visual PDF is no longer legally compliant for B2B transactions.
What Is a Hybrid E-Invoice (Factur-X / ZUGFeRD)?
A hybrid invoice merges two representations into a single file conforming to PDF/A-3 (ISO 19005-3):
1. The Human-Readable Layer
A visually formatted PDF document with your company branding, logos, itemized tables, and payment instructions that can be opened and printed in any standard PDF viewer.
2. The Machine-Readable Layer
A standardized XML document (factur-x.xml) conforming to UN/CEFACT CrossIndustryInvoice (CII) and European Standard EN 16931, embedded directly in the PDF file catalog (/EmbeddedFiles).
When accounting platforms (SAP, DATEV, Dinero, Billy, Chorus Pro, Dynamics 365) receive the hybrid PDF, their automated intake pipelines extract and parse the XML file directly into the general ledgerβcompletely eliminating human data entry errors and fragile OCR scanning.
Generating Factur-X Invoices via Tailprint API
Rather than wrestling with low-level PDF dictionary streams or complex XML schemas, Tailprint provides a dedicated canonical endpoint: POST /v1/render/einvoice.
curl -X POST https://tailprint.com/v1/render/einvoice \
-H "Authorization: Bearer sec_live_..." \
-H "Content-Type: application/json" \
-d '{
"invoiceNumber": "INV-2026-0042",
"issueDate": "2026-11-12",
"dueDate": "2026-12-12",
"currency": "EUR",
"profile": "BASIC",
"seller": {
"name": "Nordic Engineering ApS",
"vatId": "DK12345678",
"street": "Vesterbrogade 12",
"city": "Copenhagen",
"country": "DK"
},
"buyer": {
"name": "Global Logistics GmbH",
"vatId": "DE987654321",
"street": "Alexanderplatz 4",
"city": "Berlin",
"country": "DE"
},
"lineItems": [
{
"name": "Cloud Infrastructure Migration",
"quantity": 25,
"unitPrice": 140.00,
"vatRate": 25.0
}
],
"paymentIban": "DK50004403328109",
"paymentBic": "DABADKKK",
"store": true
}'
Understanding the Profiles: BASIC vs. EN 16931
| Profile | Use Case | Required Fields | B2B Compliance |
|---|---|---|---|
| BASIC | Standard commercial trade & cross-border invoicing | Seller/Buyer info, VAT IDs, Itemized totals, IBAN | 100% Compliant |
| EN 16931 (COMFORT) | Public procurement (B2G) & government tenders | All BASIC fields + Order reference, Buyer reference / Leitweg-ID | Full European Norm |
How Tailprint Embeds XML into the PDF
Under the hood, Tailprint compiles the visual invoice using Tailwind CSS, renders it to a vector PDF buffer, constructs a fully schema-validated UN/CEFACT CII XML document, and attaches it directly to the root catalog dictionary via pdf-lib:
- MIME Type: Explicitly marked as
text/xml. - AFRelationship: Declared as
/Alternativeconforming to ISO 19005-3 specifications. - Uncompressed Object Streams: Preserves compatibility with legacy ERP PDF parsers that lack FlateDecode stream decompression.
Try Our Free Online Factur-X Generator
Generate and test compliant hybrid invoices in your browser with zero registration.
Ready to build with Tailprint?
Get 100 free vector PDF and image renders every month with zero credit card required.