FPDF |
Hello together,
I implemented the FPDF Library in my CI4 project. It is in app\Libraries\fpdf.php + font folder. I added the following to autoload: Code: $classmap = [ In my Controller: PHP Code: use FPDF; If I open the page there is just the following output: %PDF-1.3 3 0 obj <> endobj 4 0 obj <> stream x�3R��2�35W(�r Q�w3T04�30PISp �Z*�[����(hx����+���(j*�d��7W endstream endobj 1 0 obj <> endobj 5 0 obj <> stream x�]R�n�0��>��L�%�DI�8���~�%E*r�ﻻvҪHX�gvVk?/���Ῑ��`]�[�x5 �3\z��P�}����PO���j�Jݍ^���x6/f�����������|���4}�z�����}���@�,ۖ-��˺E�u�^�,���<� �Z_�K� IQ����Yd����C�K�_�%q�8>�!J"V!2&bGģ%r"H��D��\}2EL1n��h�j���e��"a*H����:��d��9c���[�X1~��"�3�g��Ñ�;O��> endobj 2 0 obj << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] /Font << /F1 6 0 R >> /XObject << >> >> endobj 7 0 obj << /Producer (FPDF 1.82) /CreationDate (D:20200512140733) >> endobj 8 0 obj << /Type /Catalog /Pages 1 0 R >> endobj xref 0 9 0000000000 65535 f 0000000228 00000 n 0000000867 00000 n 0000000009 00000 n 0000000087 00000 n 0000000315 00000 n 0000000749 00000 n 0000000971 00000 n 0000001047 00000 n trailer << /Size 9 /Root 8 0 R /Info 7 0 R >> startxref 1096 %%EOF ...If I use the same files / library in a standalone .php file it creates the PDF ![]() [url=https://forum.codeigniter.com/javascript:void(0)][/url] Does anyone has an idea how to get fpdf running? best regards, Niklas
Before outputting data to the browser, you need to set the correct type of content.
PHP Code: $this->response->setHeader('Content-Type', 'application/pdf');
hello,
i get this error: is_file(): open_basedir restriction in effect. File(/var/www/vhosts/procreagency.com/dev.procreagency.com/CI/app/Libraries/fpdf182/fpdf.php/Config/Events.php) is not within the allowed path(s): (/var/www/vhosts/procreagency.com/:/tmp/) How can fix it? (09-10-2020, 02:45 AM)pws Wrote: hello @niklas Hello @pws Copy fpdf library into ThridParty folder of your app. in file app/Config/Autoload.php PHP Code: $classmap = [ in file app/Controllers/Test.php PHP Code: <?php namespace App\Controllers; (09-11-2020, 08:10 PM)vitnibel Wrote:(09-10-2020, 02:45 AM)pws Wrote: hello @niklas In the previous version (3) the pdf logic was in the view , why you're doing this in the controller ? (05-12-2020, 09:26 AM)vitnibel Wrote: Before outputting data to the browser, you need to set the correct type of content. Hi Even when properly set type of content as you advised I am getting long line of characters JVBERi0xLjMKMyAwIG9iago8PC9Ue..... Can you or anyone advice, please. |
Welcome Guest, Not a member yet? Register Sign In |