【发布时间】:2016-09-27 02:58:45
【问题描述】:
我正在使用 DOMPDF 版本。 0.7.0 从 HTML 制作 pdf 文件,但是当我需要使用粗体样式的自定义字体(arial)时出现问题。渲染后粗体字体不起作用。
这是我现在使用的 CSS 样式:
@font-face {
font-family: 'font';
font-style: normal;
font-weight: normal;
src: url(dompdf/font/arial.ttf);
}
@font-face {
font-family: 'font';
font-style: normal;
font-weight: bold;
src: url(dompdf/font/arialbd.ttf);
}
body{
font-family: 'font';
}
这里是 dompdf - php 代码:
require_once 'dompdf/autoload.inc.php';
use Dompdf\Dompdf;
$dompdf = new Dompdf();
$dompdf->load_html($html);
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$pdf = $dompdf->output();
file_put_contents('pdf/sptjm.pdf', $pdf)
pdf 没有显示粗体,请帮忙。提前致谢。
【问题讨论】:
-
HTML 本身是什么样子的?
-
@BrianS 解决了,伙计。谢谢。