【发布时间】:2021-08-11 05:30:54
【问题描述】:
我正在尝试使用 pdfkit 将网页另存为 pdf。但是,在保存的 PDF 中,没有图像。它们都有一个问号图标代替图像。为什么会这样?有可能解决这个问题吗?
例如,如下:
import pdfkit
pdfkit.from_url('https://www.quora.com/Spoilers-What-is-something-you-noticed-in-Avengers-Endgame-that-you-believe-others-have-missed/answer/Prabhhav-Sharma?ch=3&share=5feaef03&srid=aHe5', 'output.pdf')
我收到以下警告。可能是这个问题。
libpng warning: iCCP: known incorrect sRGB profile
我在网上找到的解决方案是修改 png 文件,因为 pdfkit 正在从网页加载图像,所以我在这里无法这样做。有没有办法解决这个问题?
PS:我愿意使用任何其他实用程序从网页 URL 保存 PDF。 另外,这是我个人使用的。
【问题讨论】:
标签: python pdf pdf-generation wkhtmltopdf pdfkit