Generating PDF files is required for saving and printing the documents like invoices or something.
The task is easy with free pdf generation libraries like dompdf, mpdf, fpdf etc.
Below is the code for generating pdf from html using mpdf library.
First extract mpdf files in codeigniter /library/mpdf53.
To use the code below to simply redirect the output to the function as:
This will generate the pdf file within the browser.
The task is easy with free pdf generation libraries like dompdf, mpdf, fpdf etc.
Below is the code for generating pdf from html using mpdf library.
First extract mpdf files in codeigniter /library/mpdf53.
private function _gen_pdf($html,$paper='A4')
{
$this->load->library('mpdf53/mpdf');
$mpdf=new mPDF('utf-8',$paper);
$mpdf->WriteHTML($html);
$mpdf->Output();
}
To use the code below to simply redirect the output to the function as:
public function doprint($pdf=false)
{
$this->load->library('parser');
$data = $this->data->getdata();
$output = $this->parser->parse('form',$data,true);
if ($pdf=='print')
$this->_gen_pdf($output);
else
$this->output->set_output($output);
}
This will generate the pdf file within the browser.
Working Fine. Nice !!! :)
ReplyDeleteWe can generate PDF in CodeIgniter using TCPDF library also, please check the URL
ReplyDeletehttp://www.php-guru.in/2013/html-to-pdf-conversion-in-codeigniter/
Are the above two blocks of code to be place in the controllers or what?
ReplyDeleteWhere should the codes be place at? Controller? Library? or what? Thank you
ReplyDeleteAre you searching for a good JPG to PDF converter ? If yes, then you must use this JPG to PDF converter from PDFOnline.com.
ReplyDeleteWorking Fine . Thank You
ReplyDeleteSo you want to be a work from home typist? It's a great job, and you can make great money typing online as long as you know where to start. If you can type, have a computer and internet access then there's no reason why you can't be very successful. See more png to html
ReplyDelete