fix: use Unicode-compatible Hindi fonts for IPD form PDF rendering

This commit is contained in:
DevSoftTech Server 2026-04-06 09:17:48 +05:30
parent f09e16c3a2
commit 2fc4fbd82c
2 changed files with 10 additions and 2 deletions

View File

@ -876,6 +876,9 @@ class Ipd extends BaseController
'margin_bottom' => 8,
'margin_left' => 8,
'margin_right' => 8,
'default_font' => 'freeserif',
'autoScriptToLang' => true,
'autoLangToFont' => true,
];
if (in_array($formNo, [10, 11], true)) {
@ -2352,7 +2355,12 @@ class Ipd extends BaseController
'{{CURRENT_DATETIME}}' => esc((string) ($data['generated_at'] ?? date('d-m-Y h:i A'))),
];
return strtr($templateHtml, $replacements);
$html = strtr($templateHtml, $replacements);
// Force a Unicode-capable fallback stack so Devanagari text renders in mPDF.
$fontStyle = '<style>body,table,td,th,p,span,div{font-family:freeserif,dejavusans,sans-serif !important;}</style>';
return $fontStyle . $html;
}
private function calculateCashBalanceTotals(array $rows): array

View File

@ -29,7 +29,7 @@ if ($admitDate === '') {
<meta charset="utf-8">
<style>
body {
font-family: DejaVu Sans, sans-serif;
font-family: FreeSerif, DejaVu Sans, Nirmala UI, Mangal, sans-serif;
font-size: 11px;
color: #111;
line-height: 1.35;