CodeIgniter Forums
problem with dompdf - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: problem with dompdf (/thread-20111.html)

Pages: 1 2


problem with dompdf - El Forum - 06-29-2009

[eluser]romeo[/eluser]
Dear Forum member.

i just start dompdf. and i have one problems.

this is the function.
Code:
function pdf()
{
  $this->load->plugin(‘to_pdf’);
      pdf_create(‘some test text’, ‘test_file’,FALSE);  
}
but when load it’s display message: ‘Page Load Error!’;


In my opinion i think it’s cause by my browser.(my browzer: firefox 3)
it can't create PDF file.

Please help me.


Best regards,


problem with dompdf - El Forum - 06-29-2009

[eluser]Thorpe Obazee[/eluser]
Try a demo of bambooinvoice.org of bambooinvoice. If it an causes error then it probably is. Although I doubt that it's the cause.


problem with dompdf - El Forum - 06-29-2009

[eluser]romeo[/eluser]
Dear Forum Member,


Thanks for bambooinvoice.


I have read and test it ready. But when i apply to my project Still not work. i still got message "Page load error".

This is my code.

Code:
function pdf($output = TRUE)
    {
        $this->load->plugin('to_pdf');
        $this->load->helper('file');
        $data['title'] ='Daily Report';
        $data['dialy_visitor'] = $this->report->daily_visitor();
        $html = $this->load->view('report/report_visitor_daily', $data, TRUE);
        pdf_create($html,Daily_Report,$output);
    }


Please help me agian.


Best regards,


problem with dompdf - El Forum - 06-29-2009

[eluser]Thorpe Obazee[/eluser]
[quote author="romeo" date="1246280910"]Dear Forum Member,


Thanks for bambooinvoice.


I have read and test it ready. But when i apply to my project Still not work. i still got message "Page load error".

This is my code.

Code:
function pdf($output = TRUE)
    {
        $this->load->plugin('to_pdf');
        $this->load->helper('file');
        $data['title'] ='Daily Report';
        $data['dialy_visitor'] = $this->report->daily_visitor();
        $html = $this->load->view('report/report_visitor_daily', $data, TRUE);
        pdf_create($html,Daily_Report,$output);
    }


Please help me agian.


Best regards,[/quote]

What's Daily_Report in the pdf_create function()?


problem with dompdf - El Forum - 06-29-2009

[eluser]romeo[/eluser]
I am sorry. Here just the name of file.

pdf_create($html,'Daily_Report',$output);


problem with dompdf - El Forum - 06-29-2009

[eluser]Thorpe Obazee[/eluser]
the function from Derek accepts 2 parameters only. Did you create your own plugin?


problem with dompdf - El Forum - 06-29-2009

[eluser]romeo[/eluser]
Yes, you are right. I have corrected it ready, but it's still not work.Please look at my code below:
to_pdf_pi.php
Code:
function pdf_create($html, $filename)
{
    require_once("dompdf/dompdf_config.inc.php");
    
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    $dompdf->stream($filename.".pdf");
}
?>

Here is my controller:
Code:
function pdf()
    {
        $this->load->plugin('to_pdf');
        $this->load->helper('file');
        $data['title'] ='Daily Report';
        $data['dialy_visitor'] = $this->report->daily_visitor();
        $html = $this->load->view('report/report_visitor_daily', $data, TRUE);
        echo $html;
        pdf_create($html,'Daily_Report');
    }

Here is my Veiw:
Code:
<table class="invoice_items stripe">
        <tr>
            <th>ID</th>
            <th>Visitor Name</th>
            <th>Time in</th>
            <th>Goal</th>
        </tr>
        &lt;?php foreach ($dialy_visitor as $item):?&gt;
        <tr valign="top">
            <td><p>&lt;?php echo $item->vis_id;?&gt;</p></td>
            <td>&lt;?php echo $item->vis_name;?&gt;</td>
            <td><p>&lt;?php echo $item->vis_time_in;?&gt;</p></td>
            <td><p>&lt;?php echo $item->vis_goal?&gt;</p></td>
        </tr>
        &lt;?php endforeach;?&gt;
    </table>

Best regards,


problem with dompdf - El Forum - 06-29-2009

[eluser]romeo[/eluser]
sorry, for
Code:
echo $html

it's just my testing.


problem with dompdf - El Forum - 06-29-2009

[eluser]Thorpe Obazee[/eluser]
I don't think you should use echo in the controller method.

Edit: you beat me with the 'echo'.

I believe you need some extension for dompdf to work. Have you check that it is enabled on your server?

Quote:PHP 5.0.0+ with the DOM extension enabled. Note that the domxml PECL extenstion conflicts with the DOM extension and must be disabled.



problem with dompdf - El Forum - 06-29-2009

[eluser]romeo[/eluser]
Dear sir,

I have check DOM ready it's enable.Sorry for disturbing you.

Best regards,