普通网友 2015-12-22 11:02
浏览 39

如何使用带有codeigniter的dompdf在生成的PDF中显示阿拉伯语?

I have upload the library dompdf to my project to generate PDF reports in Arabic language but it doesn't work correctly this is my controller:

 public function payslip_details($year, $month, $payslip_type, $payslip_no) {
    **$this->load->library('pdf');**
    if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] === true && $this->session->is_admin == 0) {
        $this->load->model('model_salary');
        $username = $this->session->username;  //$username = 3000;
        //start year decoding 
        $base64_year = strtr($year, '-_', '+/');
        $urisafe_year = $this->encrypt->decode($base64_year);
        $year_dec = substr($urisafe_year, 0, 4);
        //start month decoding 
        $base64_month = strtr($month, '-_', '+/');
        $urisafe_month = $this->encrypt->decode($base64_month);
        if (substr($urisafe_month, 0, 2) > 9) {
            $month_dec = substr($urisafe_month, 0, 2);
        } else {
            $month_dec = substr($urisafe_month, 0, 1);
        }
        //start type decoding 
        $base64_type = strtr($payslip_type, '-_', '+/');
        $urisafe_type = $this->encrypt->decode($base64_type);
        $type_dec = substr($urisafe_type, 0, 1);
        //start number decoding 
        $base64_number = strtr($payslip_no, '-_', '+/');
        $urisafe_number = $this->encrypt->decode($base64_number);
        $number_dec = substr($urisafe_number, 0, 1);
        // get the wages object
        $data['wages'] = $this->model_salary->getWages($username, $year_dec, $month_dec, $type_dec, $number_dec);
        $data['wages_sum'] = $this->model_salary->get_wages_sum($username, $year_dec, $month_dec, $type_dec, $number_dec);
        $data['deductions'] = $this->model_salary->getDeduction($username, $year_dec, $month_dec, $type_dec, $number_dec);
        $data['deductions_sum'] = $this->model_salary->get_dudctions_sum($username, $year_dec, $month_dec, $type_dec, $number_dec);
        $data['employee_info'] = $this->model_salary->get_employee_info($username);
        $data['payslip_info'] = $this->model_salary->get_payslip_info($year_dec, $month_dec, $type_dec, $number_dec);
        $data['payslip_type'] = $type_dec;
        $data['payslip_not_notes'] = $this->model_salary->get_payslip_no_in_notes($year_dec, $month_dec, $type_dec, $number_dec, $username);
        $data['payslip_notes'] = $this->model_salary->get_payslip_notes($year_dec, $month_dec, $type_dec, $number_dec);
        $this->load->view('includes/v_template_ess_start');
        $this->pdf->load_view('user/v_payslip_details',$data);
        $this->pdf->render();
        $this->pdf->stream("user/v_payslip_details.pdf",$data);
        $this->load->view('user/v_payslip_details', $data);
        $this->load->view('includes/v_template_ess_end');
    } else {
        redirect('/ess/error');
    }
}

It generates a PDF file but like that:

output

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100