Попробуйте это:
1.application / library / M_pdf.php:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class M_pdf {
function m_pdf()
{
$CI = & get_instance();
log_message('Debug', 'mPDF class is loaded.');
}
function load($param=NULL)
{
include_once APPPATH.'/third_party/mpdf/mpdf.php';
if ($params == NULL)
{
$param = '"en-GB-x","A4","","",10,10,10,10,6,3';
}
//return new mPDF($param);
return new mPDF();
}
}
?>
2. Скопируйте папку mpdf в приложение / third_party /
3. Контроллер:
$html = $this->load->view('filename',$data,true);
$pdfFilePath = 'path/filename';
$pdf = $this->m_pdf->load();
$pdf->AddPage('','','','','',5,5,5,5,10,10); //set margin
$pdf->WriteHTML($html,2);
ob_clean();
$pdf->Output($pdfFilePath, "F");