domPdf is showing blank page

22 Views Asked by At

Nothing is showing on the page.

library/pdf.php

defined('BASEPATH') OR exit('No direct script access allowed');
// Dompdf namespace use Dompdf\Dompdf;
class Pdf{
    public function __construct(){
        require_once dirname(__FILE__).'/dompdf/autoload.inc.php';
        $pdf = new DOMPDF(); $CI = & get_instance();
        $CI->dompdf = $pdf; 
    } 
    
}
?>

Controller

function invoice(){
        $data_user = array();
        $data_user['users'] = $this->db->get('users')->limit(2)->result();
        $this->load->view('invoice',$data_user);
        $html = $this->output->get_output();
        $this->load->library('pdf');
        $this->dompdf->loadHtml($html);
        $this->dompdf->setPaper('A4', 'landscape');
        $this->dompdf->render();
        $this->dompdf->stream("welcome.pdf", array("Attachment"=>0));
   }

I tried to change html to find if html is causing issue. To test, I did keep only one h3 heading. But still got blank page.

0

There are 0 best solutions below