使用dompdf将html转换为pdf时发生错误:致命错误:未捕获的ImagickException:NoDecodeDelegateForThisImageFormat

问题描述 投票:1回答:1

我有一个脚本,可以将HTML代码转换为PDF中的jpg和png图像。直到今天早上,一切正常。之后,对脚本或服务器不执行任何操作,它将停止工作并返回此错误:

Fatal error: Uncaught ImagickException: NoDecodeDelegateForThisImageFormat `/tmp/ca_dompdf_img_AFNf9n' @ error/constitute.c/ReadImage/544 in /var/www/vhosts/mysite.it/httpdocs/ldv/dompdf/lib/Cpdf.php:4862 Stack trace: #0 /var/www/vhosts/mysite.it/httpdocs/ldv/dompdf/lib/Cpdf.php(4862): Imagick->__construct('/tmp/ca_dompdf_...') #1 /var/www/vhosts/mysite.it/httpdocs/ldv/dompdf/lib/Cpdf.php(4984): Cpdf->addImagePngAlpha('/tmp/ca_dompdf_...', 499.0142519685, 739.6242519685, 75, 75, 3) #2 /var/www/vhosts/mysite.it/httpdocs/ldv/dompdf/src/Adapter/CPDF.php(845): Cpdf->addPngFromFile('/tmp/ca_dompdf_...', 499.0142519685, 739.6242519685, 75, 75) #3 /var/www/vhosts/mysite.it/httpdocs/ldv/dompdf/src/Renderer/Image.php(110): Dompdf\Adapter\CPDF->image('/tmp/ca_dompdf_...', 499.0142519685, 27.265748031496, 75, 75, 'normal') #4 /var/www/vhosts/mysite.it/httpdocs/ldv/dompdf/src/Renderer.php(293): Dompdf\Renderer\Image->render(Object(Dompdf\FrameDecorator\Image)) #5 /var/www/vhosts/mysite.it/httpdocs/ldv/dompdf/src/ in /var/www/vhosts/mysite.it/httpdocs/ldv/dompdf/lib/Cpdf.php on line 4862

可能发生了什么?

pdf imagemagick dompdf
1个回答
0
投票

重新启动php。确保重新启动运行项目的确切php版本。例如,在Laravel中,您可以在composer.json文件中找到它。然后重新启动Apache。

它应该解决这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.