我使用DomPDF和PDFLib作为后端。
最近我正在尝试将我的应用程序升级为使用从0.6.0到0.7.0的dompdf。
但它在以下文件中给出了异常:
https://github.com/dompdf/dompdf/tree/master/src/Adapter/PDFLib.php#L213
$families = $dompdf->getFontMetrics->getFontFamilies();
例外:
[Dompdf\Exception, 0]
Invalid property: getFontMetrics
有谁能让我知道这个错误是什么?
以下是我尝试运行的示例php脚本:
<?php
require_once('dompdf/autoload.inc.php');
// reference the Dompdf namespace
use Dompdf\Dompdf;
use Dompdf\Options;
$options = new Options();
$options->set(array(
'pdfBackend'=>'PDFLib',
'defaultMediaType'=>'print',
'defaultPaperSize'=>'A4',
'defaultFont'=>'arial',
'enable_html5_parser'=>true,
'enable_font_subsetting'=>true
));
// instantiate and use the dompdf class
$dompdf = new Dompdf($options);
$dompdf->loadHtml('hello world');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
$dompdf->stream();