【问题标题】:Use wkhtmltopdf on linux在 linux 上使用 wkhtmltopdf
【发布时间】:2017-07-21 13:56:41
【问题描述】:

我在我的 Symfony 项目中使用 wkhtmltopdf 并且一切都在我的计算机上运行。但是当我将我的项目放在 CentOS 服务器上时,我不再能够创建 pdf 文件。

我正在使用这一行,但在 linux 服务器上无法执行 .exe 文件:

$snappy = new Pdf($this->get('kernel')->getRootDir() . '/../web/wkhtmltopdf/bin/wkhtmltopdf.exe');

我尝试下载 CentOS 的 .rpm 文件,但仍然出现同样的错误。

【问题讨论】:

  • 尝试使用 exec("wkhtmltopdf google.comgoogle.pdf")

标签: symfony wkhtmltopdf snappy phpwkhtmltopdf


【解决方案1】:

我通过安装 wkhtmltopdf 解决了这个问题,就像在这个链接中解释的那样: http://www.kitpages.fr/fr/cms/182/installer-wkhtmltopdf-sous-centos-et-debian

然后我可以在 CentOS 中给出 wkhtmltopdf 的路径,即: /opt/wkhtmltopdf/bin/wkhtmltopdf

该行现在是这样的:

$snappy = new Pdf('/opt/wkhtmltopdf/bin/wkhtmltopdf');

【讨论】:

  • 最好不要放链接,因为以后可能会被删除,所以把链接的细节放在最后提供参考
猜你喜欢
  • 2012-11-27
  • 2012-10-06
  • 2020-03-20
  • 2013-02-13
  • 1970-01-01
  • 1970-01-01
  • 2012-09-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多