Welcome Guest, Not a member yet? Register   Sign In
Generating PDF file
#4

[eluser]PravinS[/eluser]
don't create library to use tcpdf, use helper, so you will be able to use tcpdf class as it is.

in controller load helper as

$this->load->helper('tcpdf_helper');


and in view use tcpdf code as

tcpdf();
$obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$obj_pdf->SetCreator(PDF_CREATOR);
$obj_pdf->SetTitle('');
$pdf_title = "";
$obj_pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $pdf_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->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$obj_pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$obj_pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$obj_pdf->SetFont('helvetica', '', 9);
$obj_pdf->setFontSubsetting(false);
$obj_pdf->AddPage();

ob_start();

<!-- YOUR HTML CODE -->

$content = ob_get_contents();
ob_end_clean();
$obj_pdf->writeHTML($content, true, false, true, false, '');
$obj_pdf->Output('output.pdf', 'I');


Messages In This Thread
Generating PDF file - by El Forum - 06-09-2013, 12:39 AM
Generating PDF file - by El Forum - 06-09-2013, 09:42 PM
Generating PDF file - by El Forum - 06-10-2013, 12:47 AM
Generating PDF file - by El Forum - 06-10-2013, 04:12 AM
Generating PDF file - by El Forum - 06-10-2013, 08:46 PM
Generating PDF file - by El Forum - 06-10-2013, 08:56 PM
Generating PDF file - by El Forum - 06-10-2013, 09:23 PM
Generating PDF file - by El Forum - 06-10-2013, 11:45 PM
Generating PDF file - by El Forum - 06-11-2013, 12:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB