mPDF with CodeIgniter

mPDF with CodeIgniter

mPDF with CodeIgniter


24 June 2016

mPDF is a PHP library which generates PDF files from UTF-8 encoded HTML. It is based on FPDF and HTML2FPDF with a number of enhancements. In the point following you will learn about integration of mPDF with CodeIgniter.

  • Now lets look at the integration of mPDF with CodeIgniter
  • Download mPDF library folder using download link mentioned above.
  • Copy this downloaded folder to third party directory of your CI project.
  • Copy mpdf.php which is the library file of the mPDF and paste into libraries folder of the project.
    Copy from : mpdf/mpdf.php and paste inside : application/libraries/
  • Load this library in to auto load if you want it to be available everywhere readily.

Now lets write a simple program using mpdf. The following PHP code will produce the most basic example with mPDF.

  • Include the main file containing the mpdf class :
  • Create an instance of the class:
        $mpdf = new mPDF();
  • Write some HTML code:
        $mpdf->WriteHTML('<p>Hello Tudip Technologies</p>');
  • Output a PDF file:

Blog Categories
Request a quote