Fix Romanian diacritics (ș ț) and Cyrillic in DomPDF-generated PDFs
DejaVu Sans lacks glyphs for U+0219 (ș) and U+021B (ț). Fix: render view to HTML first, replace with cedilla variants (U+015F/U+0163) that DejaVu Sans supports, then load HTML. Set default_font to DejaVu Sans. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -437,11 +437,16 @@ class CalendarBoard extends Page
|
||||
->orderBy('time_start')
|
||||
->get();
|
||||
|
||||
$pdf = \Barryvdh\DomPDF\Facade\Pdf::loadView('pdf.appointments', [
|
||||
$appointmentsHtml = view('pdf.appointments', [
|
||||
'appointments' => $appointments->groupBy(fn ($a) => $a->date->toDateString()),
|
||||
'periodLabel' => Carbon::parse($firstDate)->format('d.m.Y') . ' — ' . Carbon::parse($lastDate)->format('d.m.Y'),
|
||||
'generatedAt' => now()->format('d.m.Y H:i'),
|
||||
])->setPaper('a4', 'portrait');
|
||||
])->render();
|
||||
$appointmentsHtml = strtr($appointmentsHtml, [
|
||||
"\u{0219}" => "\u{015F}", "\u{0218}" => "\u{015E}",
|
||||
"\u{021B}" => "\u{0163}", "\u{021A}" => "\u{0162}",
|
||||
]);
|
||||
$pdf = \Barryvdh\DomPDF\Facade\Pdf::loadHTML($appointmentsHtml)->setPaper('a4', 'portrait');
|
||||
|
||||
$filename = 'programari_' . $firstDate . '_' . $lastDate . '.pdf';
|
||||
$disposition = request()->boolean('download') ? 'attachment' : 'inline';
|
||||
|
||||
Reference in New Issue
Block a user