我正在尝试在 Laravel 中创建的 PDF 中指定字体

我正在使用niklasravnsborg/laravel-pdf在 Laravel 中创建 PDF 文件。我想使用 Arial 字体,但是字体不起作用。


$pdf = PDF::loadView('blade', $data, [], [

    'format' => 'A4-L',

    'orientation' => 'L'

]);


森栏
浏览 156回答 2
2回答

一只名叫tom的猫

我陷入了同样的问题。下面是它的确切解决方案$pdf = PDF::loadView('blade',$data, [], [&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;format' => 'A4-L',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'orientation' => 'L',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'mode' => 'c'&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]);在刀片文件中,您应该需要在顶部添加<style type="text/css">&nbsp; &nbsp; body {&nbsp; &nbsp; &nbsp; &nbsp; font-family: Arial, Helvetica, sans-serif;&nbsp; &nbsp; }</style>

慕丝7291255

您可以使用 CSS 来使用特定字体。body {&nbsp; &nbsp; font-family: Arial, sans-serif;}
打开App,查看更多内容
随时随地看视频慕课网APP