Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dompdf/PHP is not streaming the PDF, just showing the code in page

Tags:

I have a little problem with dompdf,

Instead of generating the PDF, the screen just shows the following code:

%PDF-1.6 %���� 1 0 obj [/PDF/ImageB/ImageC/ImageI/Text] endobj 4 0 obj <> stream x����r�0��<���nH"�\�4�&ul:�Ǥ�cB��L��.� ~��!�踶,4�����92#���{�&'\� e����q���/� ���+^�N�����}qW��o�$��8!��Z�4%���A6?��i��Rj��i��S�pp��4� �o�gU�,H���&\2��Y��Қ�Zb��6�$�_v���t��0D�:nw��m��([�0��9�lu8�x�~h�F0�>���t�8��R�!˔T�J ��8���W�w#�P.���-D[0R ��j~B&���D�Ft��pLv1*§�\��Z�ל=�oq#ً��id�n��m�g?����훮"*|���� �1�Y�H˪ ��jU�iZ�Y���l�u �jɨ�b/���nV#�X�ʍo�-�l�N�oҊ@q|�4�[MI��o��=�݌iAS6��Z7M�%�(��Ȍo����P8�<�����Ym��C�X�]�RFTI��T�(7?ˬhrm�,wPk�i�5�Π��"��X�O�w�+,��l�@s�I���;�zk��#�f���,��N2'G����pU�Z�r�&���84T$>O���)��9�:3���o��ǒ� ��C(��n\����T��& �ݓ�:R�����I�'�1����h��o<��7�4�jH�@>�'���Ѩ�X��o,��7���M�;�Pߴ���B7��Ũ�X��o,��7���M��z���'����an�@�� ��HИ�<����F�ʣ�Q���|f�M��ޛ�ٽ7 ����r��%�����X���I��{�:�����5s endstream endobj 5 0 obj 827 endobj 7 0 obj <> stream x����� endstream endobj 8 0 obj 8 endobj 9 0 obj [ 4 0 R 7 0 R] endobj 10 0 obj <<> >> endobj 11 0 obj <> endobj 6 0 obj <> endobj 13 0 obj <> endobj 12 0 obj <> endobj 3 0 obj <> endobj 2 0 obj <> endobj 14 0 obj <> endobj xref 0 15 0000000000 65535 f 0000000015 00000 n 0000003158 00000 n 0000003056 00000 n 0000000063 00000 n 0000000962 00000 n 0000001319 00000 n 0000000981 00000 n 0000001061 00000 n 0000001078 00000 n 0000001108 00000 n 0000001164 00000 n 0000002872 00000 n 0000002487 00000 n 0000003212 00000 n trailer <<709E9FF5C701427DB465865115EFEEE4><709E9FF5C701427DB465865115EFEEE4>] >> startxref 3260 %%EOF

Which I believe is the PDF binary string...

But why is dompdf not generating a PDF to save?

Tkz Roberto

like image 856
Roberto Avatar asked Sep 09 '09 23:09

Roberto


1 Answers

Try adding headers to your php script (just before you write the pdf stream generated with DOMPDF):

header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="myfilename.pdf"');
like image 163
ChristopheD Avatar answered Oct 12 '22 04:10

ChristopheD