In ReportLab, Drawing object can be written into different renderers, e.g
d = shapes.Drawing(400, 400)
renderPDF.drawToFile(d, 'test.pdf')
and in Django, Canvas object can be sent via httpresponse, e.g.:
response = HttpResponse(mimetype='application/pdf')
response['Content-Disposition'] = 'filename=test.pdf'
c = canvas.Canvas(response)
in my case, my problem is that I have a reportLab script using Drawing object which saves to local file system. I now put it in Django views, and wondering whether there is a way to not save to local file system but instead sent back to client.
I hope I describe this question clearly.
Thanks for any advice!
updates
it turns out there is a function in renderPDF:
renderPDF.draw(drawing, canvas, x, y)
which can render drawing() object in the given canvas.
it turns out there is a function in renderPDF:
renderPDF.draw(drawing, canvas, x, y)
which can render drawing() object in the given canvas.