I am trying to enable inline PHP but I get the following error,
Fatal error: Class 'Font_Metrics' not found in peadeff/vendor/dompdf/dompdf/src/PhpEvaluator.php(48) : eval()'d code on line 5
here is the code that I've used.
require __DIR__ . '/vendor/autoload.php';
use Dompdf\Dompdf;
ob_start();
require "template.php";
$html = ob_get_clean();
$dompdf = new DOMPDF();
$dompdf->set_option( "is_php_enabled" , true ); // the faulty statement; otherwise pdf generation works
$dompdf->load_html( $html );
$dompdf->setPaper( "A4" , "potrait" );
$dompdf->render();
file_put_contents( "output.pdf" , $dompdf->output() );
how can I fix this?
EDIT:
actually this is the faulty line
$font = Font_Metrics::get_font( "verdana" , "bold" );
within the text/php block
In 0.7.0 FontMetrics class is now instantiated and available as $fontMetrics. The wiki will be updated when we merge the develop branch back in to master.
thanks.
I'll keep this issue open so we don't forget to update the wiki.
Most helpful comment
In 0.7.0 FontMetrics class is now instantiated and available as
$fontMetrics. The wiki will be updated when we merge the develop branch back in to master.