![]() |
No me genera los documentos PDF en el navegador - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1) +--- Forum: Regional User Groups (https://forum.codeigniter.com/forumdisplay.php?fid=25) +--- Thread: No me genera los documentos PDF en el navegador (/showthread.php?tid=92059) |
No me genera los documentos PDF en el navegador - franklin1603 - 11-23-2024 Buenos días, estoy realizando un pequeño sistema con CI4, en realidad estoy aprendiendo este esta versión ya que e realizado varios sistema en la versión 3 de CI pero quiero migrar esos sistemas a CI4, mi problema es que cuando trato de generar un documento PDF con algún listado, ya sea de productos, clientes o usuarios, no los genera en el navegador, solo me muestra en una nueva pestaña, una seria de caracteres especiales y mas nada, si le coloco al código para que los descargue directamente a la PC, si lo hace perfecto, el problema esta al querer generarlo en el navegador. No se si será alguna extensión de PHP que se debe activar. Si me pueden ayudar con este inconveniente se los agradezco. Gracias RE: No me genera los documentos PDF en el navegador - ozornick - 11-23-2024 Use DOMPdf or other library. If you see text instead of a file, check the headers and mime type RE: No me genera los documentos PDF en el navegador - BlayMo - 11-26-2024 You must add to your code the following line: $this->response->setContentType('application/pdf'); $mpdf->Output(); RE: No me genera los documentos PDF en el navegador - OscarAlex - 05-31-2025 Good morning, I'm currently working on a small system using CodeIgniter 4 as part of my learning process. I’ve developed several systems with CodeIgniter 3 and now I'm migrating them to CI4. However, I'm encountering an issue when trying to generate PDF documents—for example, lists of products, clients, or users. The PDFs aren't displaying correctly in the browser. Instead of rendering properly, a new tab opens showing only a stream of special characters. Interestingly, if I modify the code to force the PDF to download directly to the PC, it works perfectly. So the problem only occurs when trying to view the PDF in the browser. I’m not sure if this could be related to a missing or inactive PHP extension. If you have any suggestions or guidance to resolve this issue, I’d greatly appreciate your help. Thank you! RE: No me genera los documentos PDF en el navegador - InsiteFX - 06-01-2025 You need to send it to the web browser inline. Read this: CodeIgniter 4 display pdf file in web browser |