【发布时间】:2019-01-15 03:33:01
【问题描述】:
我正在为我的网站加载 Google Railway-Light 字体,它工作正常,但它没有加载到我正在生成的 PDF 中。我在我的 CSS 文件中调用它
@font-face {
font-family: "Raleway-Light";
src: url("../font/Raleway-Light.ttf");
}
当我生成 PDF 时,我正在调用 CSS 文件。
$pdf = new Pdf(
[
'mode' => Pdf::MODE_CORE,
'format' => Pdf::FORMAT_LETTER,
'orientation' => Pdf::ORIENT_PORTRAIT,
'destination' => Pdf::DEST_BROWSER,
'content' => $content,
'cssFile' => '/var/www/html/basic/web/css/sites.css',
'marginRight' => 0,
'marginLeft' => 0,
'marginTop' => 0,
'marginBottom' => 0,
'marginHeader' => 0,
'marginFooter' => 0,
'cssInline' => '',
'options' => [],
'methods' => [],
]
);
if ($user->role == 0) {
$pdf->showWaterMark = true;
}
// return the pdf output as per the destination setting
return $pdf->render();
我也将该字体加载到mpdf/ttf 文件夹中。
【问题讨论】: