Dompdf plugin "Fatal error: Class 'dompdf' not found" - probably a simple error |
[eluser]moresided[/eluser]
Hey I've basically copied the to_pdf_pi.php plugin and dompdf folder from BambooInvoice. But for some reason I'm getting the error: Fatal error: Class 'dompdf' not found in {my root}\system\plugins\to_pdf_pi.php on line 15 This is the full code of to_pdf_pi.php Code: function pdf_create($html, $filename, $stream=TRUE) Have done some rooting around on google and here and can't find anyone with exactly the same problem. Any ideas? Thanks in advance!
[eluser]moresided[/eluser]
Anyone got any ideas? Is there any common reason why a class will show as 'not found' like this?
[eluser]Unknown[/eluser]
Hi! You probably use your own __autoload function. You should add the following code inside this function: Code: if(function_exists('DOMPDF_autoload')) {
[eluser]surfgatinho[/eluser]
There are instruction in the CI wiki somewhere. Try typing codeigniter dompdf integration into Google I used this and it worked fine
[eluser]MeanStudios[/eluser]
I'm having this same exact error and I'm not sure how to fix it. I'm running CI in a local XAMPP environment. @tOMky - Not sure where I would add that to try and make a fix. Can someone please look into this? I'm running CI 1.7.1
[eluser]MeanStudios[/eluser]
Figured it out, just after the require_once line I put: Code: spl_autoload_register('DOMPDF_autoload'); Hope this helps others ![]()
[eluser]mikkelz[/eluser]
Thanks MeanStudios - just encountered this error myself: CodeIgniter 2.0 + dompdf 0.5.2 Your solution works perfectly.
[eluser]Unknown[/eluser]
dear mikkelz, can you share the tips using dompdf using codeigniter 2.0 regards cupu_coder
[eluser]Unknown[/eluser]
Thank MeanStudios, your solution is working on me but i have problem that it tries to load native CI class too(ci_clasname.class.php). So refer to this post http://ellislab.com/forums/viewthread/112970/ i combine your solution to this. in dompdf_config.inc.php: # Do not autoload CodeIgniter classes. if (strpos ($class, 'CI_') === false) { $filename = mb_strtolower($class) . ".cls.php"; require_once(DOMPDF_INC_DIR . "/$filename"); } } dompdf_gen.php: require_once APPPATH.'third_party/dompdf/dompdf_config.inc.php'; spl_autoload_register('DOMPDF_autoload'); $pdf = new DOMPDF(); $CI =& get_instance(); $CI->dompdf = $pdf; FYI : i'm using codeigniter 2.1.3,HMVC,iamfiscus / Codeigniter-DOMPDF library(https://github.com/iamfiscus/Codeigniter-DOMPDF) hope this will help someone ![]() |
Welcome Guest, Not a member yet? Register Sign In |