在Django中使用CSS和图像转换为PDF的HTML页面的困难
我正在尝试转换一个使用相当bootstrap和样式的HTML页面。我尝试了从ReportLab到WeasyPrint再到XHTML2PDF的所有内容,没有任何可用!我没有在网上找到任何东西来帮助我完成这项简单的任务。我什至尝试寻找从事此类工作的付费API。实现这一目标的最佳方法是什么?
I am trying to convert an HTML page which uses quite the bootstrap and styling. I tried everything from reportlab to weasyprint to xhtml2pdf and nothing works! I did not find anything online to help me do this simple task. I even tried looking for paid APIs that do this kind of jobs. What is the best way to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用HTML模板通过Render_TO_PDF实用程序函数创建PDF的指南。
打开您的django项目或创建一个空白
安装xhtml2pdf文档:
使用Python 3
使用Python 2
在您的项目中添加utils.py模块:
编写render_to_pdf函数:
A guide to using an HTML template to create a PDF via a render_to_pdf utility function.
Open your Django project or create a blank one
Install xhtml2pdf docs:
Using Python 3
Using Python 2
Add a utils.py module to your project:
Write the render_to_pdf function: