Welcome Guest, Not a member yet? Register   Sign In
problem with dompdf
#1

[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,
#2

[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.
#3

[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,
#4

[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()?
#5

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

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

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

[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,
#8

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

it's just my testing.
#9

[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.
#10

[eluser]romeo[/eluser]
Dear sir,

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

Best regards,




Theme © iAndrew 2016 - Forum software by © MyBB