【发布时间】:2017-06-07 18:01:39
【问题描述】:
我正在尝试打开由 PHP 使用 html2pdf 动态生成的 PDF。 它在 Firefox 和 Safari 上运行良好。但是在 Chrome 上给出 ERR_INVALID_RESPONSE。 之前一切都运行良好,直到我们将网站更新到 CodeIgniter 3.1.4。 已经到处搜索,没有找到适合我的问题的解决方案。 任何帮助将不胜感激。
function property_pdf_ver2($property_id = FALSE, $tenure_text = FALSE) {
error_reporting(E_ALL);
require_once(APPPATH . 'third_party/html2pdf/html2pdf.class.php');
$template_pdf = $this->load->view('templates/property-pdf-ver2', $data, TRUE);
$html2pdf = new HTML2PDF('L', 'A5', 'en', true, 'UTF-8', array(0, 0, 0, 0));
$html2pdf->setDefaultFont('helvetica');
$html2pdf->addFont('robotolight', false, getcwd() . '/assets/fonts/robotottf/robotolight.php');
$html2pdf->addFont('robotomedium', false, getcwd() . '/assets/fonts/robotottf/robotomedium.php');
$html2pdf->addFont('robotothin', false, getcwd() . '/assets/fonts/robotottf/robotothin.php');
$html2pdf->WriteHTML($template_pdf);
$html2pdf->Output('sample.pdf');
$html2pdf->SetFillColor(0, 128, 190);
}
【问题讨论】:
-
您能否提供您在 codeigniter 中使用的代码,以便我们为您提供帮助。
-
@timothymarois 我添加了控制器功能来支持我的问题。
-
这里回答了同样的问题stackoverflow.com/questions/34599266/…
-
@AgniusSteponavičius 我已经看过那篇文章,但没有任何意义。
标签: php codeigniter google-chrome pdf html2pdf