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 is an issue people were running into on a much older version of Chrome. If you are still seeing this issue, do the following
In Google Chrome, you have 2 options to view PDF files. You can either use Chrome pdf viewer (default) or you can use Adobe Reader
Can you check chrome://plugins (type it in address bar) ? and switch to other PDF viewer (Chrome/Adobe) by just enabling it !