CodeIgniter Forums
Problem with PDF - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Problem with PDF (/showthread.php?tid=86063)



Problem with PDF - motoroller - 01-05-2023

I Use MPDF in CI3 thare no problem

but with CI 4 next

i do like this

$this->response->setHeader('Content-Type', 'application/pdf');
$PDF->Output("File.pdf", 'I');


In Mozilla is ok, but in Chrome, its open like PDF but when i save it save like html (nmot pdf in html just page when pdf was created)


RE: Problem with PDF - Mni.day - 01-05-2023

Try Content-Disposition header


RE: Problem with PDF - motoroller - 01-05-2023

(01-05-2023, 07:14 AM)Mni.day Wrote: Try Content-Disposition header

$this->response->setHeader('Content-Type', 'application/pdf');
$this->response->setHeader('Content-Disposition', 'inline;filename="file.pdf"');

BY this way browser dold me error with protocol