4
I’m using the DomPDF
to generate the pdf. The point is that I can’t convert my html to pdf. My html is generated by several lines of php with variables and etc...
I already tried passing a variable with everything to the DomPDF::loadhtml
, but since there are so many lines of code,.
Is there any way to generate the final html and move 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();
this Works...but now i have the problem that my page can only be Seen if im logged in so i get the loginpage Even if im allready logged
– I-am Sam
I changed to Suit your problem @I-amSam
– Jhonatan Simões