我正在使用m_pdf
为英语工作,但没有使用孟加拉语。我已加载m_pdf
库
请帮助任何人
这是我的控制器代码:
public function download_pdf(){
$sess_info = $this->session->userdata('loggin_user');
$user_name = $sess_info->user_name;
$profile_id = $this->uri->segment(3);
$data = [];
//load the view and saved it into $html variable
$data['get_profile']=$this->Dashboard_model->get_profile($profile_id);
$html=$this->load->view('users/profile_pdf', $data, true);
//this the the PDF filename that user will get to download
$pdfFilePath = $user_name.".pdf";
$this->m_pdf->pdf->WriteHTML($html);
$this->m_pdf->pdf->Output($pdfFilePath, "D");
}
答案 0 :(得分:0)
在将任何数据放入PDF
之前设置UTF-8编码$this->m_pdf->pdf->allow_charset_conversion = true;
$this->m_pdf->pdf->charset_in = 'UTF-8';
答案 1 :(得分:0)
在你的ttf目录下载并添加kalpurush.ttf文件,然后在控制器中...
$mpdf = new \Mpdf\Mpdf([
'default_font_size' => 16,
'default_font' => 'kalpurush'
]);
$stylesheet = '<style>'.file_get_contents('assets/css/style2.css').'</style>';
$html = $this->load->view('print',[],true);
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($html,2);
$mpdf->Output();