thujohn / pdf-l4

Dompdf for Laravel 4
MIT License
228 stars 72 forks source link

PDF Corrupted? #39

Open johnvic opened 10 years ago

johnvic commented 10 years ago

Hello,

I installed this on our VPS with php 5.5.8 and it shows like this:

%PDF-1.3 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /ProcSet 4 0 R /Font << /F1 8 0 R >> >> /MediaBox [0.000 0.000 595.280 841.890] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Creator (DOMPDF) /CreationDate (D:20140317130236+08'00') /ModDate (D:20140317130236+08'00') >> endobj 6 0 obj << /Type /Page /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Length 139 >> stream 0.000 0.000 0.000 rg BT 34.016 784.469 Td /F1 12.0 Tf [(Put your html here, or generate it with your favourite templating system.)] TJ ET endstream endobj 8 0 obj << /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Times-Roman /Encoding /WinAnsiEncoding >> endobj xref 0 9 0000000000 65535 f 0000000008 00000 n 0000000073 00000 n 0000000119 00000 n 0000000273 00000 n 0000000302 00000 n 0000000416 00000 n 0000000479 00000 n 0000000669 00000 n trailer << /Size 9 /Root 1 0 R /Info 5 0 R >> startxref 778 %%EOF

I worked on this on my local xampp with php 5.4.17..it is working. The required extensions were installed in my vps as shown in phpinfo.

What did I miss? Please help

johnvic commented 10 years ago

Update: When I tried to change it to download instead of show..it gives me correct pdf.

thujohn commented 10 years ago

Hi.

If you see this you don't send the correct headers.

inctor commented 10 years ago

I'm getting a similar error, just with Nginx. Works fine in development on Apache server, but as soon as it's pushed to deploy server, it shows an output much similar to the above, when trying to show the PDF.

When i choose to download instead of show, it works just fine.

thujohn commented 10 years ago

Do you send correct headers ?

inctor commented 10 years ago

It seems that Nginx doesn't send the headers for the PDF by it self, as Apache is for some reason. I will try and see how i can go about sending seperate headers along with the ->show() method. Just thought that ->show() would set the headers automaticly.

thujohn commented 10 years ago

You can try this : https://github.com/thujohn/pdf-l4/issues/2#issuecomment-29370013

inctor commented 10 years ago

Seems like a good idea! I will attempt it as soon as i get into the office in the morning :+1:

Thanks for the great package otherwise, really useful :)