0

i have this code on controller

function btn_create_pdf()
{
    require_once("assets/plugins/dompdf/dompdf_config.inc.php");
    spl_autoload_register('DOMPDF_autoload');

    $dompdf = new DOMPDF();
    $dompdf->set_paper("A4", "landscape");
    $data = 'Sample Data';
    $html = $this->load->view('report/tbl_pdf',$data,true);
    $tes = $dompdf->load_html($html);
    $dompdf->render();
    $dompdf->stream("Tes.pdf", array("Attachment" => false));
}

and this tbl_pdf.php

<?php echo '<h1>'.$data.'</h1>';  ?>

the error on my view is :

Severity: Notice
Message: Undefined variable: data

How to passing some variable from PHP controller to DOMPDF ?

M Thohirin
  • 11
  • 5

0 Answers0