【问题标题】:pdf report generate in python 2.7pdf 报告在 python 2.7 中生成
【发布时间】:2017-12-16 09:56:55
【问题描述】:

我写了一个code 用于生成 pdf 文件报告,但遇到了错误。

/billing/invioce_report/ 处的类型错误

init() 只接受 1 个参数(给定 2 个)

如何编写响应并制作可下载文件?

response = HttpResponse(content_type='"application/pdf"')
        response['Content-Disposition'] = 'attachment; filename="users.pdf"'
         **writer = pyPdf.PdfFileWriter(response)**
        writer.writerow(
            ['Creation Date', 'Bill Number', 'Name', 'Product/Service Name', "Ref No", "Cost", "discounted Price","Net Amount",
            "Costomer Name", "Commission Staff", "Commission Amount", "Patyment Type"])

【问题讨论】:

  • 请编辑问题,您有一段代码可以帮助您吗?
  • @hansTheFranz 检查编辑代码

标签: django python-2.7 django-views


【解决方案1】:

如果您想创建 PDF,最好使用 wkhtmltopdf(PDF 工具包),因为您需要将内容转换为 html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多