pdf报告生成在python 2.7

时间:2017-12-16 09:56:55

标签: django python-2.7 django-views

我为pdf文件报告生成了code,但面临错误。

   / billing / invioce_report /

上的TypeError      

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"])

1 个答案:

答案 0 :(得分:0)

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