I'm having problems generating a pdf from php with DOMPDF.
This is the error that gives me
Uncaught exception 'Dompdf \ Exception' with message 'No block-level parent found.
And this is the code I use:
require_once 'dompdf/autoload.inc.php';
use Dompdf\Dompdf;
// instantiate and use the dompdf class
$dompdf = new Dompdf();
$file=file_get_contents('resultados.php');
$dompdf->load_html($file);
// (Optional) Setup the paper size and orientation
$dompdf->set_paper('A4', 'landscape');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
$dompdf->stream('document.pdf');
echo $file;?>
I have done a print of $ file and I have observed that file_get_contents () does not process the variables. I think that there may be the error. Does anyone know any way to solve this?
Thanks in advance