DOMPDF images not showing on new server

时间秒杀一切 提交于 2019-12-11 04:35:56

问题


I've created an application which outputs a PDF report based on an HTML page using DOMPDF.

This works fine on my test server, but when I've migrated it over to the live server, none of the images show in the PDF. It's not showing a RED X - just nothing there at all.

I've checked that the new server meets the requirements using the config tool, and I've enabled the "leave images in temp" debugging option, and nothing is being created in the the temp directory.

Any ideas what might have changed to stop it from working?


回答1:


It appears that if your CSS specifies your images as display:block, DOMPDF won't show them sometimes. Have changed my code so that it uses a pdf-specific CSS file without that it.

No idea why it worked on the other server though....




回答2:


Note: For windows servers I had to point the true path to the images:

<img src="C:\path\to\image\folder\image.jpg">



回答3:


I had this problem too. On the local server i could use for the image

<img src="www.test.dev/img/test.jpg" /> ,

but on the live server i had to change it to

<img src="img/test.jpg" />.

In this way you force dompdf on the server to locally access the image file.



来源:https://stackoverflow.com/questions/8996687/dompdf-images-not-showing-on-new-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!