dompdf无法加载 [英] dompdf fails to load

查看:599
本文介绍了dompdf无法加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让dompdf在内部服务器上运行。使用默认的config.inc.php设置,运行等效的演示'Hello Wolrd'脚本时,我得到以下内容:

I am trying to get dompdf running on an in-house server. With the default config.inc.php settings, I get the following when running the equivalent of the demo 'Hello Wolrd' script:

Warning: require_once(/var/www/dompdf-master/lib/php-font-lib/classes/font.cls.php): failed to open stream: No such file or directory in /var/www/dompdf-master/dompdf_config.inc.php on line 335
Fatal error: require_once(): Failed opening required '/var/www/dompdf-master/lib/php-font-lib/classes/font.cls.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/dompdf-master/dompdf_config.inc.php on line 335 

当我关闭 DOMPDF_ENABLE_AUTOLOAD 时,我不再收到此警告,但代码失败并显示以下内容:

When I turn off DOMPDF_ENABLE_AUTOLOAD, I no longer get this warning, but the code fails with the following:

Fatal error: Class 'DOMPDF' not found in /var/www/rfq/test.php on line 115

以下是代码:

require_once("/var/www/dompdf-master/dompdf_config.inc.php");

$dompdf = new DOMPDF(); // this is the line that fails
$dompdf->load_html($quotehtml);
$dompdf->render();
$dompdf->stream("rfq".$_REQUEST['quoteid'].".pdf");

这是Ubuntu 12.04,补丁的最新版本,默认的Apache设置。

This is Ubuntu 12.04, up-to-date on patches, with default Apache settings.

非常感谢。

推荐答案


  • 转到 https://github.com/PhenX/php-font-lib 并下载该库。

  • 创建 dompdf / lib / php-font-lib / classes / 目录。

  • 在zip中文件,获取 src / FontLib / 文件夹的内容并将其粘贴到新创建的目录中。

    • Go to https://github.com/PhenX/php-font-lib and download the library.
    • Create the dompdf/lib/php-font-lib/classes/ directory.
    • In the zip file, take the contents of the src/FontLib/ folder and paste that into your newly created directory.
    • 这似乎对我有用。

      这篇关于dompdf无法加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆