Today i will discus about `How to generate PDF in Codeigniter using mPDF`

Step 1. Download mPDF-Codeigniter from

Step 2. After Downloading extract it. Here is the codeigniter framework with mPDF integrated. You can copy mPDF to your existing project.

  • Copy Pdf.php library from library to your existing project library directory.
  • Copy mpdf directory from third_party directory to your existing project third_party directory.

Step 3. Now open or create a controller class and then create function in it. And then do something as bellow code –

public function mypdf() {




$pdf = $this->pdf->load();






// write the HTML into the PDF


$output = 'itemreport' . date('Y_m_d_H_i_s') . '_.pdf';


$pdf->Output("$output", 'I');



Above first i load the pdf library. Then create a instance of pdf library class. After then get the view page into a variable called html. And finally create the pdf for the view page.

Ok it is done. you can try and enjoy it.

(Visited 1,583 times, 1 visits today)

3 thoughts on "PDF Generate in Codeigniter using mPDF"

  1. Delores says:

    ma04/ria07/2012Hola me operaron de las amigdalas el 8 de mayo estamos a 4 de julio y tengo mucho dolor de garganta ….. Me fijo en el espejo y veo que tengo placas!??? Puede suceder esto????

  2. Excellent WordPress blog page and the things i need is to rotate my blog posts repeatedly with a predetermined time period. And also I’d like to shuffle my articles. Would RSS feeds get the rotated blog posts because new ones? Does somebody have this PHP code? Thanks a lot.

  3. I have noticed you don’t monetize your site, don’t waste your
    traffic, you can earn extra cash every month because you’ve got hi quality content.

    If you want to know how to make extra $$$, search for: Boorfe’s tips best adsense alternative

Leave a Reply

Your email address will not be published. Required fields are marked *