Shi*_*llz 4 python pdfkit wkhtmltopdf
嗨,我已经浏览了所有类似的帖子并实施了建议,但仍然没有运气。
运行 Python、PDFKIT、Windows 7、Google App Engine。
尝试运行程序时出现此错误
IOError:找不到 wkhtmltopdf 可执行文件:“C:/Users/nb198011/Documents/Shillan/Personal/Installs/wkhtmltopdf/bin/wkhtmltopdf.exe”
如果此文件存在,请检查此进程是否可以读取它。否则请安装 wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf
我已经使用“where”命令确认文件确实在那个位置,我可以从命令行执行 wkhtmltopdf 程序。
我将 PDFKIT 导入到我的程序中
任何新的建议将不胜感激
小智 5
我花了一些时间来弄清楚在 mac os 上将 html 页面转换为 pdf 的过程。以下是步骤,
pip install pdfkit然后设置完成,我的python文件是
import pdfkit
config = pdfkit.configuration(wkhtmltopdf="path_to_exe")
pdfkit.from_url('http://google.com', 'out.pdf',configuration = config)
pdfkit.from_file('test.html', 'out.pdf',configuration = config)
pdfkit.from_string('Hello!', 'out.pdf',configuration = config)
Run Code Online (Sandbox Code Playgroud)它工作得很好。
好吧,设法解决了。但不确定问题是什么。我从站点包中卸载了 PDFkit,并删除了它的所有环境路径。然后下载一个版本并将其复制到我的项目文件夹中,就像以前一样,它就工作了。\xe2\x80\x93 希尔兹
\n