mPDF with CodeIgniter

mPDF with CodeIgniter

Tudip

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.
    application/third_party/mpdf
    
  • 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 :
        include('../mpdf.php');
    
  • Create an instance of the class:
        $mpdf = new mPDF();
    
  • Write some HTML code:
        $mpdf->WriteHTML('<p>Hello Tudip Technologies</p>');
    
  • Output a PDF file:
        $mpdf->Output();
        exit;
    

Tudip Technologies

Tudip Technologies is a value-driven Software Services company. We deliver excellence in dedicated and business-centric web solutions incorporated with innovation and expertise as the tools to achieve business goals. Our high-quality, cost-effective, reliable, and scalable services have helped us build an enduring relationship with our clients and customers.

Latest Posts

  • All Posts
  • AI
  • Casestudy
  • Cloud
  • Digital Transformation
  • Healthcare
  • Ios
  • IOT
  • Java
  • Manufacturing
  • News
  • OTT
  • Portfolio
  • sports
  • Supply Chain
  • Support and Maintainance
  • Testing
  • WMS
    •   Back
    • Roku
    • ios
    • Testing
    • Android
    • Java
    • PHP
    • MEAN
    • Ruby
    • DotNet
    • IoT
    • Cloud
    • CMS
    • Python
    •   Back
    • Banking
    • Google

Related Posts

  • All Posts
  • Healthcare