Level 42
You are calling wrong method set_option() . Try setOptions() instead.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I add $pdf->set_option('isPhpEnabled', true); is like this :
public function listdata()
{
$data = User::all();
$pdf=PDF::loadView('print_tests.test_pdf', ['data' => $data]);
$pdf->set_option('isPhpEnabled', true);
$pdf->setPaper('L', 'landscape');
return $pdf->stream('test_pdf.pdf');
}
In body (View) I add like this :
<script type="text/php">
if ( isset($pdf) ) {
$pdf->page_script('
if ($PAGE_COUNT > 1) {
$font = $fontMetrics->get_font("Arial, Helvetica, sans-serif", "normal");
$size = 12;
$pageText = "Page " . $PAGE_NUM . " of " . $PAGE_COUNT;
$y = 15;
$x = 520;
$pdf->text($x, $y, $pageText, $font, $size);
}
');
}
</script>
There is exist error like this :
FatalThrowableError in PrintTestController.php line 21: Call to undefined method Barryvdh\DomPDF\PDF::set_option()
Note :
I using barryvdh/laravel-dompdf": "^0.7.0" (v0.7)
Is there any people who can help to me?
Please or to participate in this conversation.