wkhtmltopdf 图像不显示
我正在使用 wkhtmltopdf 来制作 pdf,但除了不显示的图像之外,其他任何东西都可以工作。如何修复?
在 localhost:3000 中它可以工作,但在服务器上部署时它不起作用。
I am using wkhtmltopdf for make pdf but anything work except image that doesn't display.How fix?
IN localhost:3000 it work but when deploy on server it does't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能与 wkhtmltopdf 的 SSL 问题有关。您是否通过 HTTPS 访问生产服务器?如果是这样,请使用图像资源的绝对路径而不是相对路径。这意味着:
不会工作:
可能会工作:
如果这解决了您的问题,如果您想避免此解决方法,以下线程可能会提供进一步的解决方案:
wkhtmltopdf 在 GitHub 上从 HTTPS 渲染图像时出现问题
This could be related to an issue wkhtmltopdf has with SSL. Do you access the production server via HTTPS? If so, use absolute paths rather than relative paths to your image resources. That means:
wont work:
might work:
If this solves your issue, the following thread might provide further solutions if you want to avoid this workaround:
wkhtmltopdf issues rending images from HTTPS on GitHub