Generating PDF not working on a live server
I tried generating pdf using the sample code:
$view = '<html><body>'
. '<p class="test-pdf">Put your html here, or generate it with your favourite '
. 'templating system.</p>'
. '</body></html>';
return PDF::load($view, 'A4', 'portrait')->show();
it worked on my localhost but not when i pushed it on a live server. This is how it appears:
%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:20150701050726+00'00') /ModDate (D:20150701050726+00'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
is there a solution for this issue? iam getting the same error
thank you
set it to be downloaded directly .. sometimes it's server's fault. (on my situation)
Running a chmod -R 777 vendor/thujohn/pdf/src/Thujohn/Pdf/dompdf/ seems to fix it for me!
Apparently dompdf needs write permissions to generate PDF on the fly..