CodeIgniter Forums
Inline PDF displayed as raw content instead rendered pdf - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: Inline PDF displayed as raw content instead rendered pdf (/thread-70725.html)



Inline PDF displayed as raw content instead rendered pdf - singgihdh - 05-21-2018

I tried to display inline pdf using CI4 but it return raw content of pdf (seem like postscript) instead return rendered content of pdf. it was not happen in CI3. I tried using 'header("Content-type: application/pdf");' but nothing. what should i do?

sorry if bad english


RE: Inline PDF displayed as raw content instead rendered pdf - Paradinight - 05-21-2018

(05-21-2018, 12:11 AM)singgihdh Wrote: I tried to display inline pdf using CI4 but it return raw content of pdf (seem like postscript) instead return rendered content of pdf. it was not happen in CI3. I tried using 'header("Content-type: application/pdf");' but nothing. what should i do?

sorry if bad english

https://bcit-ci.github.io/CodeIgniter4/libraries/response.html#setting-headers

edit:
https://bcit-ci.github.io/CodeIgniter4/concepts/http.html


RE: Inline PDF displayed as raw content instead rendered pdf - singgihdh - 05-21-2018

(05-21-2018, 12:54 AM)Paradinight Wrote:
(05-21-2018, 12:11 AM)singgihdh Wrote: I tried to display inline pdf using CI4 but it return raw content of pdf (seem like postscript) instead return rendered content of pdf. it was not happen in CI3. I tried using 'header("Content-type: application/pdf");' but nothing. what should i do?

sorry if bad english

https://bcit-ci.github.io/CodeIgniter4/libraries/response.html#setting-headers

edit:
https://bcit-ci.github.io/CodeIgniter4/concepts/http.html

Still didnt work until i comment
Code:
$this->setContentType('text/html');
in /system/HTTP/Response.php