Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
Here is some useful code to generate PDF using CodeIgniter:
Please check this ...
http://www.phpclasses.org/package/2905-PHP-Convert-HTML-to-PDF-using-Web-services.html
u can use JASPER REPORT Jaspersoft
u can Use DOMPDF
u can use TCPDF
u can use mPDF
i thik that is the best try it
Create one PHP helper file in “application/helpers/” directory of codeigniter, say “pdf_helper.php”, then copy below given code and paste it in helper file
Helper: application/helpers/pdf_helper.php
function tcpdf(){ require_once('tcpdf/config/lang/eng.php'); require_once('tcpdf/tcpdf.php');}Then in controller file call the above helper, suppose our controller file is “createpdf.php” and it has method as pdf(), so the method pdf() will load the “pdf_helper” helper and will also have any other code.
Controller: application/controllers/createpdf.php
function pdf(){ $this->load->helper('pdf_helper');/* ---- ---- ---- ---- your code here ---- ---- ---- ---- */ $this->load->view('pdfreport', $data);}Now create one view file, say “pdfreport.php” in “application/views/” directory, which is also loaded in pdf() method in controller. So in view file we can directly call the tcpdf() function which we have defined in “pdf_helper” helper, which will load all required TCPDF classes, functions, variable etc. Then we can directly use the TCPDF example codes as it is in our current controller or view. Now in out current view “pdfreport” copy the given code below:
View: application/views/pdfreport.php
tcpdf(); $obj_pdf =new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT,true,'UTF-8',false); $obj_pdf->SetCreator(PDF_CREATOR); $title ="PDF Report"; $obj_pdf->SetTitle($title); $obj_pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $title, PDF_HEADER_STRING); $obj_pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN,'', PDF_FONT_SIZE_MAIN)); $obj_pdf->setFooterFont(Array(PDF_FONT_NAME_DATA,'', PDF_FONT_SIZE_DATA)); $obj_pdf->SetDefaultMonospacedFont('helvetica'); $obj_pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $obj_pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $obj_pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $obj_pdf->SetFont('helvetica','',9); $obj_pdf->setFontSubsetting(false); $obj_pdf->AddPage(); ob_start();// we can have any view part here like HTML, PHP etc $content = ob_get_contents(); ob_end_clean(); $obj_pdf->writeHTML($content,true,false,true,false,''); $obj_pdf->Output('output.pdf','I');
I have used HTML2PDF so many times and its really very simlple and flexible.
use this libarary for CI this is lite weight.
http://www.tcpdf.org/
Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?