【发布时间】:2019-07-11 15:11:22
【问题描述】:
运行 php 脚本时我的 IIS 服务器结果 QFontEngine failure。
基本上我有从 html 生成 pdf 的 laravel web 应用程序,它在幕后使用类似这样的东西
<?php
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;
require __DIR__ . '/vendor/autoload.php';
$process = Process::fromShellCommandline('wkhtmltopdf --lowquality "C:\WINDOWS\TEMP\test.html" "C:\WINDOWS\TEMP\test.pdf"', null, null);
$process->run();
// executes after the command finishes
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
echo $process->getOutput();
如果通过 IIS Web 服务器运行以下脚本,该命令的输出如下:
Loading pages (1/6)
[> ] 0%
[======> ] 10%
[==============================> ] 50%
QFontEngine::loadEngine: GetTextMetrics failed ()
QFontEngineWin: GetTextMetrics failed ()
QFontEngineWin: GetTextMetrics failed ()
QFontEngineWin: GetTextMetrics failed ()
QFontEngineWin: GetTextMetrics failed ()
QFontEngineWin: GetTextMetrics failed ()
QFontEngineWin: GetTextMetrics failed ()
QFontEngineWin: GetTextMetrics failed ()
QFontEngineWin: GetTextMetrics failed ()
[============================================================] 100%
Counting pages (2/6)
[============================================================] Object 1 of 1
Resolving links (4/6)
[============================================================] Object 1 of 1
Loading headers and footers (5/6)
Printing pages (6/6)
[> ] Preparing
[============================================================] Page 1 of 1
Done
如果我像 php index.php 这样在终端内运行此脚本,则不会出现 QFontEngine 失败和作业成功等错误。
我已经检查了这个问题“Issue running 32-bit executable on 64-bit Windows”,但我的字体服务正在运行,所以我什至不知道在哪里寻找解决方案?
提前谢谢你。
【问题讨论】:
-
“但是我的字体服务正在运行” - 不是那个服务给你这些错误吗?另外,您是否尝试过该帖子中的解决方案?
-
错误输出来自名为 wkhtmltopdf 的应用程序。我检查了我的字体服务,它运行时没有任何错误。
标签: php iis windows-10 wkhtmltopdf