简体   繁体   English

带有pdfigniter的dompdf

[英]dompdf with codeigniter

I followed this tutorial: 我遵循了本教程:

https://github.com/EllisLab/CodeIgniter/wiki/PDF-generation-using-dompdf 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: 在dompdf的配置文件(config_dompdf.inc.php)上,我执行了以下操作:

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. 按照教程,我将dompdf目录放在system / plugins下。 But you can see above that on line 233, there is an error because of an incorrect path. 但是您可以在上面的233行上看到,由于路径错误而导致错误。 How do I fix the path? 我该如何解决? (define("DOMPDF_DIR", realpath(dirname('./system/plugins/dompdf/')));) (定义(“ DOMPDF_DIR”,realpath(dirname('./ system / plugins / dompdf /')))))

Thanks! 谢谢!

A custom loader that is on autoload is conflicting with DOMPDF, that's the reason is doesn't work. 自动加载的自定义加载程序与DOMPDF冲突,这是原因,它不起作用。 Switched to TCPDF since the custom loader is used by all controllers of the app. 由于应用程序的所有控制器都使用了自定义加载程序,因此已切换到TCPDF。

this file take $_GET['input_file'] as name of file that should be converted to pdf. 该文件以$_GET['input_file']作为应转换为pdf的文件名。 ie

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. 如果您已将dompdf_config.inc.php从dompdf目录中的通常位置DOMPDF_DIR则只需更改DOMPDF_DIR的值。 Otherwise dompdf is already set up to populate that constant with the correct path. 否则,已经设置了dompdf,以使用正确的路径填充该常数。 Based on the information you have provided I do not believe you should have modified the default value. 根据您提供的信息,我认为您不应修改默认值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM