[reportlab-users] how can i save PDF report into django model

Andy Robinson andy at reportlab.com
Wed Jun 22 03:50:06 EDT 2011


On 22 June 2011 06:23, Asif Jamadar <asif.jamadar at rezayat.net> wrote:

>          response = HttpResponse(mimetype='application/pdf')

>

>                          response['Content-Disposition'] =

> 'attachment;filename=ANALYSIS_REPORT.pdf'

>

>                         buffer = StringIO()

>                        doc = SimpleDocTemplate(response)

>                      doc.build(document)

>                      pdf = buffer.getvalue()


It looks from this like you are not actually using the 'buffer' variable. Try
doc.build(document, filename=buffer)

Originally we allowed a filename, but later we generalised it to allow
a file-like object.

- Andy


More information about the reportlab-users mailing list