我想将pandas数据框保存为pdf格式。
import pdfkit as pdf
config = pdf.configuration(wkhtmltopdf="C:\Program Files\wkhtmltopdin\wkhtmltopdf.exe")
pdf.from_url('http://google.com', 'out.pdf',configuration=config)
--> not working somehow even though I downloaded wkhtmltopdin on several different locations
from weasyprint import HTML
HTML(string=pd.read_csv('cor.csv').to_html()).write_pdf("report.pdf")
dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2
--> not working : Tried several times to solve this isseue, but cannot download library
我在stackoverflow和其他网站上又尝试了5个包和方法,但无法解决。
有没有更多的包裹我可以试试?这让我得了癌症
提前谢谢。
是否考虑过先绘制Matplotlib表,然后导出表图形?
我发现这是简单的,高度可定制和操作系统独立(据我所知)。我可以在客户端的服务器上实现这一点,而无需下载任何附加包。
一种选择是从:
然后使用QT将HTML转换为PDF,如下所示:
我从html to pdf获得了第二位代码,并在Mac OSX上进行了测试,结果是肯定的。
相关问题 更多 >
编程相关推荐