【问题标题】:How to convert html template (with images) to pdf?如何将html模板(带图像)转换为pdf?
【发布时间】:2018-09-05 07:46:34
【问题描述】:

我已经为此苦苦挣扎了几天。我正在尝试将 django 中的 html 模板转换为 pdf。我已经在单独的实例中同时使用了 reportlab 和 xhtml2pdf 来完成这部分,但无法使用任何一个选项来转换图像。使用 xhtml2pdf 我不断收到错误“警告:需要一个有效的文件名!文件名是 URL,例如 /home/products/2312312

如果您知道我如何做到这一点,我将非常感谢您的帮助!

【问题讨论】:

  • 请附上与问题相关的部分模板
  • @AlexandrTatarinov 您还在寻找一种方法来创建包含 img 的 HTML 的 PDF 吗?

标签: python django python-3.x python-2.7 django-templates


【解决方案1】:

可能是help

  • 确保静态/媒体 URL 正确。
  • 提供具有有效扩展名的网址。

【讨论】:

    猜你喜欢
    • 2019-12-08
    • 2018-05-06
    • 1970-01-01
    • 1970-01-01
    • 2015-05-05
    • 1970-01-01
    • 2015-04-19
    • 2019-06-13
    • 2016-07-18
    相关资源
    最近更新 更多