Generating a PDF in Codeigniter using mPDF

Hey, today I will show you integrating mPDF into CodeIgniter Application. mPDF is a PHP Class, by using this we can easily generate PDF files from HTML Templates.So styling PDF files as easy styling your HTML template as you wish.

Here is the updated post on CodeIgniter 3 – Using mPDF with CodeIgniter 3

Following are the simple steps to use mPDF with CodeIgniter.

Download and extract mPDF

Download mPDF from : and Extract it to your application/third_party/ folder of your CodeIgniter.

Create a new file in your application/libraries/ name it M_pdf.php and copy past the blow PHP Script.

That is it. You had successfully integrated mPDF in CodeIgniter. Now let’s use it.

How to Use

Load the mPDF library just like your load other CI’s other libraries and then call pdf property. See the below example code for better understanding.

That’s it.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.