1
Ajax调用MPDF生成PDF这个问题可能是重复的,但我没有找到一个有效的答案,这种类型的错误。我的代码运行良好,而不使用ajax,但如果使用ajax会产生错误。使用在codeginiter
$this->load->library('m_pdf');
$this->data['title']="Sales Report PDF";
$this->data['description']="Sales report in PDF format";
$data = $this->get_sales_report_for_pdf();
$html=$this->load->view('dashboard/sales_report_pdf',$data, true);
$pdfFilePath ="Salesreport-".time()."-download.pdf";
$pdf = $this->m_pdf->load();
$pdf->WriteHTML($html,2);
$pdf->Output($pdfFilePath, "D");
谁能懂得这方面的工作?
什么错误ü[R得到些什么? –
发布错误请求 –
仅供参考,如果您通过ajax调用该函数,则不起作用。因为视图不会通过Ajax调用 –