【发布时间】:2020-02-23 07:02:45
【问题描述】:
如何将此 URL 传递给 PDF? 我尝试使用以下代码,但不起作用 我尝试使用 PNG 的 URL 或页面截图,但不起作用,只生成一个空的 pdf/图像
有什么办法吗?
网址: http://windte1910.acepta.com/v01/0EF57BFD40060E245941AE43E3F7DAB700A06338
代码:
import pdfkit
path_wkthmltopdf = r'C:\Program Files\wkhtmltopdf\bin\\wkhtmltopdf.exe'
config = pdfkit.configuration(wkhtmltopdf = path_wkthmltopdf)
pdfkit.from_url("http://windte1910.acepta.com/v01/0EF57BFD40060E245941AE43E3F7DAB700A06338", "out2.pdf", configuration=config)
输出:
Loading pages (1/6)
Warning: A finished ResourceObject received a loading progress signal. This might be an indication of an iframe taking too long to load.
Warning: A finished ResourceObject received a loading finished signal. This might be an indication of an iframe taking too long to load.
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done
True
【问题讨论】:
-
你的 SO 是哪一个?
-
@GiovaniSalazar Windows 10
-
我发现了一些......问题是网络有一个 iframe ..例如,如果你用这个 windte1910.acepta.com/ca4webv3/… 重新输入网址,这个工作......
-
@GiovaniSalazar 谢谢,这行得通!但在 url 中显示如下内容: %3A%2F%2F ,有没有办法用 :// 替换它?
-
我在下面回答...您可以使用meyerweb.com/eric/tools/dencoder 对链接进行解码/编码
标签: python pdf url png screenshot