使用 Pisa 将 pdf 写入磁盘
我可以在浏览器中的 django 中生成 .pdf 的 pisa,但是如果我想自动将文件写入磁盘怎么办?我想要做的是能够在指定的时间点生成.pdf版本文件并将其保存在上传目录中,因此没有浏览器交互。这可能吗?
I have pisa producing .pdfs in django in the browser fine, but what if I want to automatically write the file to disk? What I want to do is to be able to generate a .pdf version file at specified points in time and save it in a uploads directory, so there is no browser interaction. Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这是可能的。例如,使用 Greg Newman 作为初学者:
您只需要使用模板、字典中的数据和文件名调用 write_pdf 。
Yes it is possible. for example, using code from Greg Newman as a starter:
You just need to call write_pdf with a template, data in a dict and a file name.