Problem using dompdf |
[eluser]benjamin[/eluser]
Hi all, I tried getting the dompdf generator to work with CI (as described in http://codeigniter.com/wiki/PDF_generati...ng_dompdf/ - slight modification is that I included dompdf as a library as opposed to a helper) but am getting nowhere. Basically, I'm getting no error reports, nothing. Just a blank page. My webapp hangs after I call: $dompdf->render(); I created a class called PDF_Generator as my CI library and placed it into application/libraries: Code: class PDF_Generator { The dompdf folder has been placed into application/libraries too. I was wondering whether anybody have any tips for me? Or maybe somebody got it to work and wouldn't mind sharing his/her solution? This question follows http://ellislab.com/forums/viewthread/175392/ which remained unanswered. Thanks for your time and help!
[eluser]DjLeChuck[/eluser]
Hi benjamin, I've try this and it works : 1. Dl dompdf and extract it in ./application/libraries/dompdf 2. Create your library PDF_Generator in ./application/libraries/Pdf_generator.php 3. Make this in my Controller Code: <?php Maybe is your template wrong ?
[eluser]dark_lord[/eluser]
Can you paste you view? Remember to use the Code: $html = $this->load->view('pdf_template', $data, true);
[eluser]benjamin[/eluser]
Ah, since I was just testing it, I didn't bother to use a view - I just passed in straight html. 2 sec, I will code one up.
[eluser]benjamin[/eluser]
OK, so, loading an empty view works, but still results in an error. Also, the pdf isn't written to file: %PDF-1.3 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R /OpenAction 8 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 9 0 R >> >> /MediaBox [0.000 0.000 612.000 792.000] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Creator (DOMPDF) /CreationDate (D:20110303172051+00'00') /ModDate (D:20110303172051+00'00') >> endobj 6 0 obj << /Type /Page /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Length 75 >> stream 0.000 0.000 0.000 rg BT 34.016 723.208 Td /F1 12.0 Tf [(asdasdasd)] TJ ET endstream endobj 8 0 obj [6 0 R /Fit] endobj 9 0 obj << /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Times-Roman /Encoding /WinAnsiEncoding >> endobj xref 0 10 0000000000 65535 f 0000000008 00000 n 0000000091 00000 n 0000000137 00000 n 0000000291 00000 n 0000000320 00000 n 0000000434 00000 n 0000000497 00000 n 0000000622 00000 n 0000000650 00000 n trailer << /Size 10 /Root 1 0 R /Info 5 0 R >> startxref 759 %%EOF The view that I am using is: Code: <html> Thanks, one step closer!
[eluser]dark_lord[/eluser]
Try adding the values below in the stream Code: $dompdf->stream($filename.".pdf", array('attachment' => 1);
[eluser]dark_lord[/eluser]
Can you paste you code the PDF DOM helper and the view code?
[eluser]benjamin[/eluser]
Sure, here goes: PDF_Generator: Code: <?php Code: <?php |
Welcome Guest, Not a member yet? Register Sign In |