I am trying to open a PDF that is dynamically generated by PHP using html2pdf. It is working well on Firefox and Safari. However on Chrome giving ERR_INVALID_RESPONSE. All was working well before, till we updated our site to CodeIgniter 3.1.4. Have already searched everywhere and didn't found any suitable solution for my issue. Any help would be highly appreciated.
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);
}
It's weird but after a careful debugging I found the cause for issue. The below line was preventing the chrome from loading the PDF. I had to remove it for the function to work.
$html2pdf->SetFillColor(0, 128, 190);
Thanks all, for your consideration towards my issue.