在我的函数中,在mpdf-> confing_cp.php中添加了以下代码
CASE "meera": $unifonts = "meera,meeraI"; break;
还在mpdf-> config_font.php
中添加了以下代码"meera" => array(
'R' => "Meera.ttf",
),
在我的控制器中我也需要lanscape视图,所以以下是我的控制器中的代码来生成pdf
`
function export_pdf() {
$this->data['admin_page_title'] = 'Script';
$this->data['portrite'] = $this->input->post('formate');
this->data['script_pdf']=$this->Script_model->get_selected();
ini_set('memory_limit','250M');
$html = $this->load->view('admin/script/pdf_view', $this->data,true);
//include_once APPPATH.'/third_party/mpdf/mpdf.php';
$this->load->library('pdf');
$pdf = $this->pdf->load();
$pdf = new mPDF('ml', 'A4');
$pdf->AddFont('meera','','meera.ttf',true);
$pdf->SetFont('meera','',14);
if($this->data['portrite']=="landscape") {
$pdf=new mPDF('utf-8', 'A4-L');
}
// $pdf->SetAutoFont(AUTOFONT_ALL);
// $pdf->setHTMLFooter($footer);
$pdf->WriteHTML($html);
$pdf->Output();
exit;`
}`