typeset.sh
Search
K

ZUGFeRD

Zentraler User Guide des Forums elektronische Rechnung Deutschland
ZUGFeRD, is a standardized format for electronic invoices. Developed collaboratively by businesses and government entities, ZUGFeRD aims to facilitate seamless and efficient invoicing processes. This standard combines both a human-readable PDF document and structured XML data within a single file, allowing for easy interpretation by both humans and automated systems. ZUGFeRD promotes interoperability and simplifies the exchange of invoices across diverse business systems, fostering a more streamlined and cost-effective invoicing ecosystem. As a widely accepted standard, ZUGFeRD enhances transparency, reduces errors, and contributes to the digital transformation of invoicing practices in Germany and beyond.
While Typeset.sh itself does not offer XML generation functionality, there are alternative packages available to fulfill this need. One such example is https://github.com/easybill/zugferd-php. To attach your XML to the PDF file, setup a save handler designed for this purpose. Refer to the example below for details:
$html = "...";
$xml = "...";
$service = new \Typesetsh\HtmlToPdf();
$service->saveHandler['ZUGFeRD'] = new \Typesetsh\HtmlToPdf\ZUGFeRD($xml);
$result = $service->render($html, \Typesetsh\UriResolver::all());
$result->toFile(__DIR__.'/invoice.pdf');
Additional parameters are available if required:
\Typesetsh\HtmlToPdf\ZUGFeRD(
string $xml,
string $name = 'factur-x.xml',
string $description = 'Factur-X/ZUGFeRD Invoice',
string $type = 'INVOICE',
string $conformanceLevel = 'BASIC',
Pdf\Date $modTime = null,
string $version = '1.0',
)