简体   繁体   中英

how to view pdf file in codeigniter using dompdf?

I can't figure out how can I view pdf file. it automatically download instead of viewing it in browser.

here is my code

public function index(){
    $data_user['users'] = $this->db->get('tbl_client')->result();
    $this->load->view('Dashboard/Print/user_list', $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("mypdf.pdf");
}


SOLVED! With the answer below..

If still facing the issue. make sure you are not using any download manager.

Hope this helps

 $this->dompdf->stream("mypdf.pdf", array("Attachment" => 0));
 exit(0);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM