代码之家  ›  专栏  ›  技术社区  ›  Arvin Jason Cabrera

如何使用dompdf在codeigniter中查看pdf文件?

  •  0
  • Arvin Jason Cabrera  · 技术社区  · 5 年前

    这是我的密码

    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..
    

    0 回复  |  直到 5 年前
        1
  •  1
  •   Vimal    5 年前

    希望这有帮助

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