diff --git a/src/Services/PdfInvoiceService.php b/src/Services/PdfInvoiceService.php index 89615ac..dbf87d6 100644 --- a/src/Services/PdfInvoiceService.php +++ b/src/Services/PdfInvoiceService.php @@ -12,6 +12,8 @@ class PdfInvoiceService { $html = $this->buildHtml($invoice, $lines, $settings); + $fontDir = dirname(__DIR__) . '/fonts'; + $mpdf = new Mpdf([ 'mode' => 'utf-8', 'format' => 'A4', @@ -19,6 +21,16 @@ class PdfInvoiceService 'margin_bottom' => 25, 'margin_left' => 25, // DIN 5008: 25mm links 'margin_right' => 15, // DIN 5008: 15mm rechts + 'fontDir' => [$fontDir], + 'fontdata' => [ + 'opensans' => [ + 'R' => 'OpenSans-Regular.ttf', + 'B' => 'OpenSans-Bold.ttf', + 'I' => 'OpenSans-Italic.ttf', + 'BI' => 'OpenSans-BoldItalic.ttf', + ], + ], + 'default_font' => 'opensans', ]); $mpdf->SetTitle('Rechnung ' . ($invoice['rechnungs_nr'] ?? 'Entwurf')); @@ -107,11 +119,13 @@ class PdfInvoiceService
|
{$h($settings['firma'] ?? '')} · {$h($settings['strasse'] ?? '')} · {$h($settings['plz'] ?? '')} {$h($settings['ort'] ?? '')}
+
{$h($customerName)}
{$h($inv['strasse'])} @@ -119,11 +133,12 @@ class PdfInvoiceService |
- RECHNUNG | +Rechnung |
|
{$h($settings['firma'] ?? '')} - {$h($settings['inhaber'] ?? '')} + Inh. {$h($settings['inhaber'] ?? '')} {$h($settings['strasse'] ?? '')} {$h($settings['plz'] ?? '')} {$h($settings['ort'] ?? '')} USt-ID: {$h($settings['ust_id'] ?? '')} @@ -216,7 +231,7 @@ HTML; private function buildCss(): string { return <<
+
-
+
-
= $h($settings['firma'] ?? '') ?> · = $h($settings['strasse'] ?? '') ?> · = $h(($settings['plz'] ?? '') . ' ' . ($settings['ort'] ?? '')) ?>
-
+
-
= $h($customerName) ?>
= $h($invoice['strasse']) ?> = $h($invoice['plz']) ?> = $h($invoice['ort']) ?> = $h($invoice['land']) ?> RECHNUNG
+ Rechnung
= $h($settings['firma'] ?? '') ?> - = $h($settings['inhaber'] ?? '') ?> + Inh. = $h($settings['inhaber'] ?? '') ?> = $h($settings['strasse'] ?? '') ?> = $h(($settings['plz'] ?? '') . ' ' . ($settings['ort'] ?? '')) ?> USt-ID: = $h($settings['ust_id'] ?? '') ?> diff --git a/src/fonts/OpenSans-Bold.ttf b/src/fonts/OpenSans-Bold.ttf new file mode 100644 index 0000000..51a6bb8 Binary files /dev/null and b/src/fonts/OpenSans-Bold.ttf differ diff --git a/src/fonts/OpenSans-BoldItalic.ttf b/src/fonts/OpenSans-BoldItalic.ttf new file mode 100644 index 0000000..7f58199 Binary files /dev/null and b/src/fonts/OpenSans-BoldItalic.ttf differ diff --git a/src/fonts/OpenSans-Italic.ttf b/src/fonts/OpenSans-Italic.ttf new file mode 100644 index 0000000..88c01b6 Binary files /dev/null and b/src/fonts/OpenSans-Italic.ttf differ diff --git a/src/fonts/OpenSans-Regular.ttf b/src/fonts/OpenSans-Regular.ttf new file mode 100644 index 0000000..abd6746 Binary files /dev/null and b/src/fonts/OpenSans-Regular.ttf differ diff --git a/src/version.txt b/src/version.txt index 0ebbc35..b52cf7f 100644 --- a/src/version.txt +++ b/src/version.txt @@ -1 +1 @@ -1-260427 +1-260428 |