Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with the headers. #24

Closed
NicoxDJ opened this issue Sep 4, 2018 · 2 comments
Closed

Problems with the headers. #24

NicoxDJ opened this issue Sep 4, 2018 · 2 comments

Comments

@NicoxDJ
Copy link

NicoxDJ commented Sep 4, 2018

Hello!
This script doesn't really work correctly on Laravel 5.5

When i did everything and try to test it, it doesn't actually create the pdf headers.
From the "Hello World" demo, the only thing that i see is this:

%PDF-1.3 3 0 obj <> endobj 4 0 obj <> stream x�3R��2�35W(�r Q�w3T0��30P�ISp � ����Z�������(hx����+����(j�d������Q 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���[�X�1~��"�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.81) /CreationDate (D:20180904171808) >> endobj 8 0 obj << /Type /Catalog /Pages 1 0 R >> endobj xref 0 9 0000000000 65535 f 0000000230 00000 n 0000000867 00000 n 0000000009 00000 n 0000000087 00000 n 0000000317 00000 n 0000000751 00000 n 0000000971 00000 n 0000001047 00000 n trailer << /Size 9 /Root 8 0 R /Info 7 0 R >> startxref 1096 %%EOF

So what i have to change, to work correctly?

@stevenosse
Copy link

Hello man!
Just add exit; at the end of your code .. for example :
$fpdf = new Fpdf; $fpdf->AddPage(); $fpdf->SetFont('Courier', 'B', 18); $fpdf->Cell(50, 25, 'Hello World!'); $fpdf->Output(); exit;

@robie69
Copy link

robie69 commented Dec 31, 2018

I'm running 5.4. When you move this to a controller(which I assume you probably will), you can use

return response($fpdf->Output(), 200)->header('Content-Type', 'application/pdf');

@codedge codedge closed this as completed Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants