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

时间:2015-12-22 11:02:28

标签: php codeigniter

我已将库dompdf上传到我的项目以使用阿拉伯语生成PDF报告,但它无法正常工作这是我的控制器:

 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');
    }
}

它生成一个PDF文件,但是:

output

0 个答案:

没有答案