Skip to content

ZUGFeRD E-Invoice

ZUGFeRD è uno standard tedesco per fatture elettroniche che combina PDF human-readable con dati XML machine-readable.

Cos'è ZUGFeRD

ZUGFeRD incorpora un file XML (conforme CII) come allegato nel PDF, consentendo elaborazione automatica mantenendo leggibilità umana.

Esempio Base

php
use Yeeefang\TcpdfNext\Core\Document;

// Crea PDF fattura
$pdf = Document::create()
    ->setTitle('Fattura #2026-001')
    ->addPage()
    ->setFont('Helvetica', '', 12)
    ->cell(0, 10, 'Fattura #2026-001', newLine: true);

// Genera XML ZUGFeRD
$xml = generateZugferdXml($invoiceData);

// Incorpora XML come allegato
$pdf->addAttachment(
    data: $xml,
    filename: 'zugferd-invoice.xml',
    mimeType: 'text/xml',
    description: 'ZUGFeRD Invoice Data',
    relationship: 'Alternative'
);

// Imposta metadata XMP per ZUGFeRD
$pdf->setXmpMetadata([
    'zugferd:ConformanceLevel' => 'BASIC',
    'zugferd:DocumentType' => 'INVOICE',
]);

$pdf->save('zugferd-invoice.pdf');

Livelli Conformità

  • MINIMUM — Dati base fattura
  • BASIC WL — Senza dettagli riga
  • BASIC — Con dettagli riga
  • COMFORT — Informazioni estese
  • EXTENDED — Tutti campi opzionali

Validazione

Usa validator ZUGFeRD per verificare conformità XML:

bash
java -jar validationtool.jar zugferd-invoice.pdf

Rilasciato sotto licenza LGPL-3.0-or-later.