Sunday, October 5, 2014

What is mPDF ?

mPDF is a PHP class which genarates PDF files from UTF-8 encoded HTML.It is based on FPDF and HTML2FPDF ,with a number of enhancements.




First we have to download mpDF.Download mpdf.

Then go to your project folder and put that mpdf file inside  /application/third_party/mpdf.



Then we have to create library file.
Go to /application/libraries/pdf.php





















Add this lines to the pdf.php file.Make sure to give the correct path (line:13) for mpdf.php file.


Then we have to call this library in controller.

This is my controller in here i have defined the logo and other details i have to display in this pdf file as well as you can see how to use database values.

pdfController:












We can set location where we need to genarate  pdf file.

Line 8:$pdfFilePath = FCPATH."downloads\GoBuyAndSell.pdf";

Genarated PDF File:



Tagged: ,

0 comments: