I'm using mPDF library for generating PDF files from HTML page. It is working nice in firefox but it is not display PDF file in chrome browser.
I'm getting following error while generate PDF in chrome.
Following is my code for generate PDF using mPDF
ob_clean();
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="' . $yourFileName . '"');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
$mpdf = new PDF( 'c','A4','','',15, 15,10,14,0,0);
$mpdf->useOnlyCoreFonts = false;
$mpdf->SetDisplayMode('real');
$mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list
$stylesheet = file_get_contents(APPPATH . 'third_party/mpdf/style.css');
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($html);
$mpdf->Output();
This maybe is the problem with generated pdf. If it works on firefox, download the file and try to open it. And if pdf viewer in you pc outputs corrupted pdf, then you might need to tweak your code. I am facing the same problem. Chrome won't open it because of the corrupted pdf.
Hope my answer will let you go to a journey of debugging. Cheers. :D