0

I am trying to make a pdf file with mpdf.

require_once __DIR__ . '/vendor/autoload.php';

$mpdf = new \Mpdf\Mpdf(['mode' => 'utf-8', 'format' => 'A4-L']);
$mpdf->use_kwt = true;
$html = file_get_contents('template.php');
$mpdf->WriteHTML($html);
$mpdf->Output();

the file that I am trying to get converted to a pdf has several variables declared and used in the template itself. The issue that I am encountering is that when you use file_get_contents it just gets the file without executing it at all. Is there a way to get the content only after it is executed and everything is parsed?

0 Answers0