I'm using DomPDF
to generate the pdf. The question is that I can not convert my html to pdf. My html is generated by several php lines with variables and etc ...
I have tried to pass a variable with everything to DomPDF::loadhtml
, but since there are so many lines of code, I can not.
Is there any way to generate the final html and pass to the variable?
// include autoloader
require_once 'dompdf/autoload.inc.php';
// reference the Dompdf namespace
use Dompdf\Dompdf;
// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml('hello world');
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'landscape');
// Render the HTML as PDF
$dompdf->render();
// Get the generated PDF file contents
$pdf = $dompdf->output();
// Output the generated PDF to Browser
$dompdf->stream();