|
@@ -34,7 +34,8 @@ $bodyHtml = $converter->convert($markdown)->getContent();
|
|
|
|
|
|
|
|
$css = <<<'CSS'
|
|
$css = <<<'CSS'
|
|
|
<style>
|
|
<style>
|
|
|
-body { font-family: 'DejaVu Sans', sans-serif; font-size: 10pt; color: #111; }
|
|
|
|
|
|
|
+/* mPDF 内置 Sun-ExtA(sun-exta),覆盖中文、日文、韩文;勿用 DejaVu,否则会显示为方块 */
|
|
|
|
|
+body { font-family: 'sun-exta', sans-serif; font-size: 10pt; color: #111; }
|
|
|
h2 { font-size: 14pt; margin: 0 0 8px 0; }
|
|
h2 { font-size: 14pt; margin: 0 0 8px 0; }
|
|
|
h3 { font-size: 11pt; margin: 16px 0 8px 0; }
|
|
h3 { font-size: 11pt; margin: 16px 0 8px 0; }
|
|
|
blockquote { margin: 0 0 10px 0; padding: 6px 10px; background: #f9fafb; border-left: 3px solid #d1d5db; font-size: 9pt; color: #4b5563; }
|
|
blockquote { margin: 0 0 10px 0; padding: 6px 10px; background: #f9fafb; border-left: 3px solid #d1d5db; font-size: 9pt; color: #4b5563; }
|
|
@@ -61,7 +62,9 @@ $mpdf = new \Mpdf\Mpdf([
|
|
|
'margin_bottom' => 14,
|
|
'margin_bottom' => 14,
|
|
|
'margin_left' => 12,
|
|
'margin_left' => 12,
|
|
|
'margin_right' => 12,
|
|
'margin_right' => 12,
|
|
|
- 'default_font' => 'dejavusans',
|
|
|
|
|
|
|
+ 'default_font' => 'sun-exta',
|
|
|
|
|
+ 'autoScriptToLang' => true,
|
|
|
|
|
+ 'autoLangToFont' => true,
|
|
|
]);
|
|
]);
|
|
|
$mpdf->WriteHTML($html);
|
|
$mpdf->WriteHTML($html);
|
|
|
$mpdf->Output($outPath, \Mpdf\Output\Destination::FILE);
|
|
$mpdf->Output($outPath, \Mpdf\Output\Destination::FILE);
|