【发布时间】:2023-03-28 16:20:02
【问题描述】:
我有自己编写的 pdf 生成代码。下载 pdf 时,pdf 中有一些很棒的字体图标。它不可见。我已经尝试了一些解决方案。我已将fontawesome-webfont.ttf 放入mpdf/ttfonts。在此之后,我在fontvariablesmpdf/src/ 中编写了一些代码:
'fontdata' => [
"fontawesome" => [
'R' => "fontawesome-webfont.ttf",
],
];
在此之后,我在 pdf 生成部分编写了一些代码,例如:
$mpdfConfig = array(
'mode' => 'utf-8',
'format' => 'A4-L',
'orientation' => 'P',
'default_font_size' => 10,
'default_font' => 'Arial',
'margin_top' => 17,
'margin_bottom' => 23,
//'tempDir' => '/tmp'
);
$mpdf = new \Mpdf\Mpdf($mpdfConfig);
$mpdf->curlAllowUnsafeSslRequests = true;
$stylesheet = '.fa-long-arrow-right { font-family: fontawesome; }';
$html = $this->load->view('temp/'.$date.'/stream_finder_'.$exam_id.'_'.$uid,$data,true);
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($html,2);
$mpdf->Output('Stream-finder-report.pdf', 'D');
在html页面中,
<i class="fa fa-long-arrow-right" aria-hidden="true" style="left: 6px;position: absolute;font-size: 20px;color: #07bb7b;"></i>
但在生成的 pdf 中,fa-long-arrow-right 不可见。谁能建议如何纠正这个问题?
【问题讨论】:
标签: html css codeigniter mpdf