【发布时间】:2013-03-03 17:10:42
【问题描述】:
我刚刚找到wkhtmltopdf,使用 webkit 的惊人的 html 转换器。我已经在我的开发机器上尝试过它,它很简单而且效果很好。
如何最好地与基于 django 的站点集成?
我找到了python bindings,但他们假定对如何安装我没有的东西有一定程度的了解。例如
you need libwkhtmltox.* somewhere in your LD path (/usr/local/lib)
you need the directory src/include/wkhtmltox from wkhtmltopdf
somewhere on your include path (/usr/local/include)
在安装了这些 python 绑定之后,我该如何使用它们?我可以拨打哪些电话?
生成的 pdf 是否必须保存到高清文件中,或者我可以将其从视图中流出来吗?
例如:
response['Content-Disposition'] = 'attachment; filename='+letter_name
response['Content-Type'] = 'Content-type: application/octet-stream'
response['Content-Length'] = bytes
return response
【问题讨论】:
标签: python django wkhtmltopdf python-bindings