Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Dompdf problem
  • Hi
    I am using pdf package.. i have installed and worked with some simple examples with tcpdf that works fine. the problem with tcpdf is that it lakes many css features so i 've decided to use dompdf. i am having some problem even in my hello word example.. the file is get downloaded but gives error 'Unable to open document File type html Document (text/html) not supported'
    my code is below $pdf = \Pdf::forge('dompdf')->init();
    $pdf->set_paper('a4');
    $page1 = "<h2 European<br>Printer if the Year<br>Awards 2012<h2>";
    $pdf->load_html($page1);
    $pdf->render();
    $pdf->stream('test.pdf'); I have checked all the permission and set it to 777 for now to make sure its not a permission problem.
    I am looking forward to your help thanks!
  • Looks like the mimetype isn't properly set on the downloaded file. I've never used dompdf, so I can't help you. Maybe someone else can?
  • Which one are you using? I have tried mpdf as well.. but also having the same problem
  • I've been using tcpdf sofar, but I can't say I'm doing anything fancy. Generating business documents is pretty straight-forward.
  • shabir wrote on Wednesday 31st of October 2012:
    $page1 = "<h2 European<br>Printer if the Year<br>Awards 2012<h2>";

    I was having trouble getting that package to work as well, so I pretty much bypassed the extras and called DomPDF directly. But if what you have posted is what you're trying to use, and it's not just a typo, then that may be the issue. I know those PDF creators are sticklers for valid HTML. So $page1 would need to be
    <h2>European<br />Printer if the Year<br />Awards 2012</h2>
    

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion