Welcome Guest, Not a member yet? Register   Sign In
Generate a PDF from a Form - How to do it???
#11

[eluser]Alex91[/eluser]
Thanks so far.
I'm now on my laptop not on my pc.

I would check this tomorow.
Will let you know.
#12

[eluser]Alex91[/eluser]
Sorry, but I was busy with other stuff...

But yes, that is on my to_pdf_pi.php...

But still not working...
#13

[eluser]Andy Ingham[/eluser]
Is it still the following error you're receiving?:

Code:
Fatal error: Class 'DOMPDF' not found in C:\xampp\htdocs\alex91\system\plugins\to_pdf_pi.php on line 6

Can you confirm that this is on line 6 of 'to_pdf_pi.php'?:

Code:
$dompdf = new DOMPDF();

It's basically saying that it's trying to create a new instance of the 'DOMPDF' class, but this class hasn't been defined.

This class is defined in the 'plugins/dompdf/include/dompdf.cls.php' file. Does that file exist, in exactly that location? I've attached a screenshot showing where the file is in my setup.

If all this is set up correctly then I'm afraid I don't know where this is going wrong. Let me know...
#14

[eluser]Alex91[/eluser]
It is working Big Grin
Only got a new problem Tongue

I work with forms.
So i added a name, when i submit it, the name is not showen.
What is the best way to display that in a view from a form?

On line 6 i added this:
Code:
spl_autoload_register('DOMPDF_autoload');
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
function pdf_create($html, $filename, $stream=TRUE)
{
    //require_once("dompdf/dompdf_config.inc.php");
    require_once(BASEPATH."plugins/dompdf/dompdf_config.inc.php");
    spl_autoload_register('DOMPDF_autoload');
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename.".pdf");
    } else {
        $CI =& get_instance();
        $CI->load->helper('file');
        write_file("./invoices_temp/invoice_$filename.pdf", $dompdf->output());
    }
}
?>




Theme © iAndrew 2016 - Forum software by © MyBB