[英]Dompdf is not rendering image
I am using DOMPDF library to convert HTML to PDF at runtime. 我正在使用DOMPDF库在运行时将HTML转换为PDF。 However, I am facing an issue related to images.
但是,我面临与图像有关的问题。 System displays images when I render HTML code but when I convert it into PDF, it replace all images by "broken_image.png".
当我呈现HTML代码时,系统显示图像,但是当我将其转换为PDF时,它将所有图像替换为“ broken_image.png”。 I have placed complete url (given below) of images, its still not working for me :/ .
我已经放置了完整的图片网址(如下所示),但它仍然对我不起作用:/。 Below is the example image url:
以下是示例图片网址:
<img src='http://img.uksoccershop.com/images/man-utd-gk-away-shirt-2012-13.jpg'/>
Can anyone please tell me how can I resolve the issue. 谁能告诉我如何解决此问题。 Thanks in advance.
提前致谢。
To enable remote images for DOMPDF u have to alter the config dompdf_config.inc.php
Look near line 284 : 要为DOMPDF启用远程图像,您必须更改
dompdf_config.inc.php
的配置284号线附近:
def("DOMPDF_ENABLE_REMOTE", false);
This should be set to true
. 这应该设置为
true
。 Also be sure that the temp directory defined near line 103 is writeable : 还要确保在第103行附近定义的temp目录是可写的:
def("DOMPDF_TEMP_DIR", sys_get_temp_dir());
DOMPDF is not a browser, it won't download images or any other assets, it simply converts HTML/CSS into a PDF representation. DOMPDF不是浏览器,它不会下载图像或任何其他资源,它只是将HTML / CSS转换为PDF表示形式。
You'll need something like wkhtmltopdf to achieve this. 您将需要类似wkhtmltopdf的工具来实现此目的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.