Generating a PDF in Codeigniter using mPDF
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.
That’s it. Very quick and simple. The mPDF files are untouched in a self contained directory, but called by the custom /application/library/pdf.php script.
FWIW: Here’s an example file created using mPDF.
Update:
A major benefit of this approach over some of the others I’ve seen is that this wrapper does not copy any code from the mPDF library onto your file structure elsewhere. If you wish to upgrade the mPDF library, just replace the files below /application/third_party/mpdf
The wrapper should take care of the rest with minimal changes.
Further reading
If you need any help with mPDF rather than just fitting it into CodeIgniter, these are the best places to visit:
mPDF questions on Stackoverflow
mPDF Examples
mPDF Forum
mPDF Documentation
source