这是我的密码
options = {
"enable-local-file-access": True,
...
}pdfkit.from_string(html_file, pdf_file, options=options, ...)由于我使用Django模板,下面是我的代码来引用
<img src="{{ static_root }}{% static '../../target.svg' %}" alt="">我在html中使用本地图像文件,它只是在pdf输出文件中显示一个空白框。
我还尝试使用"base64“来解决基于这个链接pdfkit not converting image to pdf的问题。
对我来说不太管用。
发布于 2022-03-09 21:11:55
已实现的pdfkit不喜欢.svg,我使用.png格式
发布于 2022-08-16 17:04:02
wkhtmltopdf 0.12.6 (Ubuntu 22.04.1 LTS) (控制台)-全部正常
wkhtmltopdf --enable-local-file-access ./file.html ./file.pdf在python脚本中也不是那么糟糕:)
options = {'enable-local-file-access': None}
pdfkit.from_file("file.html", "file.pdf", options=options) # all ok!
pdfkit.from_string(html_str, "file.pdf", options=options) # no images (jpg, png) :(https://stackoverflow.com/questions/71384881
复制相似问题