I'm trying to use inline PHP in the DOMPDF loadhtml()
function. Below is my sample code:
$pdf->loadHTML('<html>
<head>
<title>My first PHP Page</title>
</head>
<body>
This is normal HTML code
<?php
echo $test;
?>
Back into normal HTML
</body>
</html>');
when I use $pdf->stream()
to output this pdf from it only prints "
This is normal HTML code Back into normal HTML ". echo $test;
does not produce any output.
I have an array with some string values. I need to iterate through each of them just like it is done in the blade preprocessor.
Why am I not able to use inline PHP this way?
PS. I have tried using the render()
function but it fails because it is a Protected method.