如何在CI框架中使用dompdf循环生成pdf?

时间:2018-07-16 08:53:51

标签: codeigniter-3 dompdf

foreach($this->input->post('properties') as $propertyID){
    $data['property'] = $this->Property->get_property_by_id($propertyID,$this->user_id);
    $html = $this->load->view('backend/mail_template/send_bulk_property',$data,true);
    $html = $this->output->get_output();
    $this->load->library('pdf');
    $this->dompdf->loadHtml($html);
    $this->dompdf->setPaper('A4', 'portrait');
    $this->dompdf->render();
    ob_start();
    $output = $this->dompdf->output();
    file_put_contents('./uploads/'.$data['property']['slug'].'.pdf', $output);    
    ob_end_clean();
}

0 个答案:

没有答案