如何将此URL传递到PDF? 我尝试下面的代码,但没有工作 我试着用URL到PNG,或者一个页面的截图,但是没有用,只是生成了一个空的pdf/图像
有什么解决办法吗?你知道吗
url: 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
我发现的问题是,网站有一个iframe,所以它看起来是空白的。。。如果你改变这个网址
http://windte1910.acepta.com/ca4webv3/index.jsp?url=http://windte1910.acepta.com/v01/0EF57BFD40060E245941AE43E3F7DAB700A06338
那就行了。。。如果你对html/css有一定的了解,可以在googlechrome控制台上找到它,也许你应该考虑使用beautifulSoup来获取iframe的内容
相关问题 更多 >
编程相关推荐