安装laravel 5.7时,我使用“ spipu / html2pdf”将html代码配置为pdf:“ ^ 5.2”并收到错误消息:
语法错误,意外的'> ='(T_IS_GREATER_OR_EQUAL),预期结束 文件
当我尝试将DejaVu Sans字体附加到我的应用程序时 我在源代码的html中使用这种字体,例如
style="font-family: 'DejaVu Sans'
我的控制权:
$pdf_content= !empty($requestData['pdf_content']) ? $requestData['pdf_content'] : '';
$pdf_filename= !empty($requestData['pdf_filename']) ? $requestData['pdf_filename'] : '';
$page_orientation = 'P';/* P or Portrait (default) L or Landscape */
$page_format = 'A4'; // A4 A6
$page_lang = 'en';
$page_unicode = true;
$page_encoding = 'UTF-8';
$page_margins = array(5, 5, 5, 8);
$page_pdfa = false;
$html2pdf = new Html2Pdf( $page_orientation, $page_format, $page_lang, $page_unicode, $page_encoding, $page_margins, $page_pdfa );
$html2pdf->addFont( 'DejaVu Sans', '', public_path('/fonts/DejaVuSans/DejaVuSans-Bold.ttf') );
$html2pdf->addFont( 'courier' );
$html2pdf->addFont( 'helvetica' );
$html2pdf->addFont( 'symbol' );
$html2pdf->addFont( 'times' );
$html2pdf->writeHTML( $pdf_content );
$html2pdf->output($pdf_filename, 'D');
But that is not syntax error of my application anyway, if to comment line
$html2pdf->addFont( 'DejaVu Sans', '', public_path('/fonts/DejaVuSans/DejaVuSans-Bold.ttf') );
没有错误并且生成了pdf文件,但是带有DejaVu Sans字体的区域是黑色的,我想这是因为DejaVu Sans字体 在应用程序中找不到。 在我这边看起来有什么错误:https://imgur.com/a/vuGWUPp
为什么出错以及如何解决?
谢谢!