DOMPDF with CODEIGNITER

后端 未结 6 640
刺人心
刺人心 2021-01-07 12:16

I am trying to get dompdf working with codeigniter, I download the file from here https://github.com/dompdf/dompdf/releases the version was 0.7.0 and then I put inside my co

6条回答
  •  孤城傲影
    2021-01-07 12:24

    You can integrate the DomPDF with Codeigniter in two easy steps.

    1) Download the domPDF library and place it into application/library directory.

    2) Create a file name pdf.php file, place following code inside the file and place it into library directory.

    ci()->load->view($view, $data, TRUE);
    
            $this->load_html($html);
        }
    }
    ?>
    

    Now in your Controller file call it as this

    defined('BASEPATH') OR exit('No direct script access allowed');
    class Welcome extends CI_Controller {
     function my_DOMPDF(){
      $this->load->library('pdf');
      $this->pdf->load_view('common/template');
      $this->pdf->render();
      $this->pdf->stream("welcome.pdf");
     }
    }
    

    You can get full step by step configurations here

提交回复
热议问题