dompdf 和 img 标签,图像不会显示
以下是调用 $dompdf->render() 和 $dompdf->output() 之前的 HTML:
<img src="http://www.example.com/images/Logo.png" />
在浏览器中查看、打印或以 HTML 形式通过电子邮件发送时,所有其他发票都可以正常显示图像。当我在应用程序中单击“生成 PDF”时,它会以 PDF 格式呈现发票,但徽标丢失。我已经添加了一条调试线,通过电子邮件将其发送到 render() 的原始 HTML 发送给我,对我来说它看起来很好。
有谁知道为什么 dompdf 不会显示此图像?
Here is the HTML just before $dompdf->render() and $dompdf->output() are called:
<img src="http://www.example.com/images/Logo.png" />
All other invoices display the image fine when viewing in the browser, or printing it, or emailing it as HTML. When I click 'Generate PDF' inside of our application, it renders the invoice in PDF, except the logo is missing. I have put a debugging line in to email me the raw HTML it sends to the render(), and it looks fine to me.
Does anyone have any idea why dompdf won't display this image?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一个想法:如果您为图像提供完整的 URI,它将被视为外部图像,因此定义的常量
DOMPDF_ENABLE_REMOTE
必须设置为 true。An idea: if you are providing full URI to the image it is treated as external, so defined costant
DOMPDF_ENABLE_REMOTE
must be set to true.看起来您必须在
src
参数中传递服务器路径
而不是服务器 url
http://www.flashnutz.com/2009/08/images-not-working-in-dompdf/< /a>
Looks like you have to pass the
server path
and not theserver url
in thesrc
paramhttp://www.flashnutz.com/2009/08/images-not-working-in-dompdf/
我的 .png 图像不会神秘地加载,但当我在渲染之前输出 html 时它会显示。
我能够使用此进行调试
输出文件位于
C:/Users/USERNAME/AppData/Local/Temp/log.htm
但错误显示存在权限错误。
我悲伤的真正原因是
src=""
开头的一个简单的空格My .png image would not load mysteriously but it would display when I outputted the html before rendering.
I was able to debug using this
The output file was located at
C:/Users/USERNAME/AppData/Local/Temp/log.htm
But the error showed there was a permissions error.
The true cause of my grief was a simple whitespace at the beginning of the
src=""