PDF Generate in Codeigniter using mPDF

Mahabubur Rahman
11

 
Today i will discus about `How to generate PDF in Codeigniter using mPDF`

Step 1. Download mPDF-Codeigniter from 
here.
Step 2. After Downloading extract it. Here is the codeigniter framework with mPDF integrated. You can copy mPDF to your existing project.
  • Copy Pdf.php library from library to your existing project library directory.
  • Copy mpdf directory from third_party directory to your existing project third_party directory.
Step 3. Now open or create a controller class and then create function in it. And then do something as bellow code –
<?php function mypdf() { $this->load->library('pdf'); $pdf = $this->pdf->load(); $html = $this->load->view('welcome_message', null, true); $pdf->WriteHTML($html); // write the HTML into the PDF $output = 'itemreport' . date('Y_m_d_H_i_s') . '_.pdf'; $pdf->Output("$output", 'I'); } ?>
Above first i load the pdf library. Then create a instance of pdf library class. After then get the view page into a variable called html. And finally create the pdf for the view page.
Ok it is done. you can try and enjoy it.


PDF Generate in Codeigniter using DOMPDF

Post a Comment

11Comments
  1. Great Article. Thank you for sharing! Really an awesome post for every one.

    IEEE Final Year projects Project Centers in Chennai are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation. For experts, it's an alternate ball game through and through. Smaller than expected IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble. Final Year Projects for CSE It gives you tips and rules that is progressively critical to consider while choosing any final year project point.

    Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining the authors explore the idea of using Java in Big Data platforms.
    Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai


    The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

    ReplyDelete
  2. I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much.

    Want to Fill Your Career GAP Call Now & Get Genuine Experience Certificate
    Expereince Certificate Providers in Bangalore- Boost Your Career

    ReplyDelete
Post a Comment