dompdf with codeigniter
-
21-08-2019 - |
Question
I followed this tutorial:
https://github.com/EllisLab/CodeIgniter/wiki/PDF-generation-using-dompdf
However, I can't seem to set the path right. On the config file of dompdf (config_dompdf.inc.php) I did the following:
define("DOMPDF_DIR", realpath(dirname('./system/plugins/dompdf/')));
I get this error:
Message: require_once(/var/www/myApp/system/plugins/include/functions.inc.php) [function.require-once]: failed to open stream: No such file or directory
Filename: dompdf/dompdf_config.inc.php
Line Number: 233
As per the tutorial, I placed the dompdf directory under system/plugins. But you can see above that on line 233, there is an error because of an incorrect path. How do I fix the path? (define("DOMPDF_DIR", realpath(dirname('./system/plugins/dompdf/')));)
Thanks!
Solution
A custom loader that is on autoload is conflicting with DOMPDF, that's the reason is doesn't work. Switched to TCPDF since the custom loader is used by all controllers of the app.
OTHER TIPS
this file take $_GET['input_file']
as name of file that should be converted to pdf. i-e
http://localhost/dompdf/dompdf.php?input_file=[nameofyourfile]
You only need to change the value of DOMPDF_DIR
if you have moved dompdf_config.inc.php from its usual location in the dompdf directory. Otherwise dompdf is already set up to populate that constant with the correct path. Based on the information you have provided I do not believe you should have modified the default value.