Typeset.sh
HomeNewsDemoPricing
  • Getting started
    • Installation
    • Using typeset.sh
    • First template
    • CSS and paged media
      • Page counters
      • Page selectors
      • Page groups
      • Running elements
      • Bleed area
    • Convert from URL
    • Document Metadata
    • Changelog
  • Advanced guides
    • QR codes
    • Save handlers
    • Error handling
    • Signing a PDF
    • PDF Standards
      • ZUGFeRD
      • PDF/A
      • PDF/UA
      • PDF/X-4
    • Color profiles
    • JavaScript
    • Common Object/Classes
      • createPdf function
      • HtmlToPdf
      • Result Object
Powered by GitBook
On this page
  1. Advanced guides
  2. PDF Standards

ZUGFeRD

Zentraler User Guide des Forums elektronische Rechnung Deutschland

PreviousPDF StandardsNextPDF/A

Last updated 1 year ago

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 . 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',
)

https://github.com/easybill/zugferd-php