mPDF with CodeIgniter
Posted in by Tudip at 05:06 Comments Off on mPDF with CodeIgniter
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.
- mPDF can be downloaded from: http://www.mpdf1.com/mpdf/download
- Now lets look at the integration of mPDF with CodeIgniter
- Download mPDF library folder using download link mentioned about.
- 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:
- Reference: http://mpdf1.com/manual/index.php?tid=184
- In order to explore mPDF further, you can check the mpdf’s comprehensive user guide at http://mpdf1.com/manual/index.php?page=introduction