Hybrid e-invoicing in PHP: ZUGFeRD and Factur-X
EU e-invoicing rules increasingly require structured invoice data in covered workflows. A hybrid file pairs a readable PDF with data for tax and procurement systems. NextPDF Enterprise produces both layers.
E-invoicing mandates are spreading across the EU, changing what an invoice has to be. Covered workflows pair a readable PDF with embedded XML for tax authorities and procurement systems to process as machine-readable data.
The widely adopted answer is a hybrid invoice: a single file that serves both purposes. The named formats are ZUGFeRD (Germany) and Factur-X (France)—two profiles of the same idea.
One file, two layers
A hybrid e-invoice combines two layers inside one archival PDF/A-3 container:
- The visual invoice—what a person opens and reads. An ordinary, well-rendered PDF page.
- The embedded structured XML—a machine-readable payload modelled on EN 16931, the EU semantic standard for the core invoice, attached inside the PDF per the ZUGFeRD / Factur-X profile.
Your customer opens it and sees an invoice. Their accounting system opens it and reads the embedded XML directly as structured data. One file carries both layers through the same delivery channel.
Where NextPDF fits
The visual layer is exactly what the engine does on the open-source Core — render your invoice HTML to a clean PDF page:
use NextPDF\Core\Document;
$doc = Document::createStandalone();
$doc->addPage();
$doc->writeHtml($invoiceHtml); // your styled invoice
$doc->save('invoice.pdf');The structured layer—generating the EN 16931 XML and embedding it into a PDF/A-3 archival container per the ZUGFeRD / Factur-X profile—is a NextPDF Enterprise capability. The same engine that renders the visual invoice produces the hybrid output, so the human-readable layer you can try in Core today is the layer your customers will read.
Producing a conformant hybrid invoice requires mapping your real invoice data to the EN 16931 semantic model. We review that workflow with you against your actual data.
CII payload targeting EN 16931
NextPDF Enterprise produces output that targets the EN 16931 model and the ZUGFeRD / Factur-X profiles. That recipient’s validator and the correctness of your invoice data determine whether a specific invoice is accepted by a given tax authority or buyer portal. Your invoice data remains your responsibility. Using NextPDF does not, by itself, make you compliant with any e-invoicing mandate. It gives you an engine that builds output to the right shape and a team ready to validate a real workflow with you end to end.
NextPDF provides capability and evidence. You remain responsible for correctness and compliance.
- The deeper walkthrough: E-invoicing use case.
- What Enterprise adds: NextPDF Enterprise.
- Render the visual layer free: /try.