Search by

atwx / silverstripe-zugferd

adiwidjaja

Embed ZUGFeRD / Factur-X / XRechnung XML into PDFs (PDF/A-3) in Silverstripe; optional integration with atwx/silverstripe-mpdf

Package info

github.com/atwx/silverstripe-zugferd

Type:silverstripe-vendormodule

pkg:composer/atwx/silverstripe-zugferd

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.1.0 2026-11-21 12:20 UTC

This package is auto-updated.

Last update: 2026-11-23 17:14:58 UTC


README

Embeds ZUGFeRD / Factur-X / XRechnung XML into a PDF and turns it into a PDF/A-3 hybrid e-invoice (via horstoeko/zugferd's ZugferdDocumentPdfMerger). Works with PDFs from any source – mPDF, headless Chrome, wkhtmltopdf, uploads.

Building the XML stays in your project (fill a ZugferdDocumentBuilder from your invoice model); this module does the embedding and its configuration.

use Atwx\Zugferd\ZugferdPdf;

$pdf = ZugferdPdf::create()->embed($pdf, $builder);   // builder, XML string or XML file path

With atwx/silverstripe-mpdf

When atwx/silverstripe-mpdf is installed, its renderer embeds the e-invoice by itself:

$builder = ZugferdDocumentBuilder::createNew(ZugferdProfiles::PROFILE_XRECHNUNG_3);
// … fill the builder …

$pdf = Injector::inst()->get(PdfRenderer::class)->renderTemplate('Invoice_pdf', $invoice, [
    'profile' => 'invoice',
    'zugferd' => $builder,           // or an XML string / XML file path; null = plain PDF
    'zugferd_options' => [],         // per-call overrides of the config below
]);

Configuration

Atwx\Zugferd\ZugferdPdf:
  creator_tool: 'My App'          # added to the PDF creator
  relationship_type: ''           # Data (default) | Alternative | Source
  deterministic: false            # reproducible output, e.g. for tests
  show_attachment_pane: null      # open the attachment pane in viewers
  meta_templates:                 # sprintf templates filled from the XML
    title: ''
    author: ''
    subject: ''
    keywords: ''

Extension hook on ZugferdPdf: updateMerger($merger, $options).

Tests

SS_PHPUNIT_FLUSH=1 php phpunit.phar --configuration phpunit.xml.dist