dompdf codeigniter – CodeIgniter customer Library for convert HTML to PDF – Create custom PDF library for generate PDF document in CodeIgniter using Dompdf.
dompdf codeigniter
I would like to present how to use domPdf library with codeigniter to generate PDF reports. and here step by step Convert HTML to PDF in CodeIgniter using Dompdf.
How to Convert HTML to PDF in CodeIgniter using Dompdf Library?
Step 1: Download Fresh Codeigniter 3
download from here : Download Codeigniter 3.
Step 2: Download dompdf library from GitHub
https://github.com/dompdf/dompdf/releases
Load CodeIgniter Pdf library to use Dompdf class.
“application/libraries”/pdf.php
dompdf = $pdf; } } ?>
Convert HTML content and generate PDF using Dompdf.
Step 3: Add Controller Method
application/controllers/Welcome.php
load->view('welcome_message'); } function getallmemberdata(){ $html = $this->output->get_output(); $this->load->library('pdf'); $this->pdf->loadHtml($html); $this->pdf->setPaper('A4', 'landscape'); $this->pdf->render(); $this->pdf->stream("welcome.pdf", array("Attachment"=>0)); } }
Step-4: Add Route
application/config/routes.php
Step 5: Add View File
application/views/resportmembers.php
Codeigniter 3 - Generate PDF from view using dompdf library with example Codeigniter 3 - Generate PDF from view using dompdf library with example - www.pakainfo.com
Id | Member Name | |
---|---|---|
1 | Mayur | [email protected] |
2 | Krishna | [email protected] |
Now you can open bellow URL on your browser:
http://localhost:8000/resportmembers
Don't Miss : create pdf in codeigniter using mpdf
I hope you get an idea about dompdf codeigniter.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.