I use wkhtmltopdf to create PDF files, however, I don’t know how to return them correctly, so I had to write them to the media folder and then redirect them to the file I just created.
Edit: Ian advises writing to STDOUT, so I changed the wkhtmltopdf command to do this, but now I don't know how to return this content.
I am trying to use subprocess.Popen as follows:
r = HttpResponse(Popen(command_args), mimetype='application/pdf')
r['Content-Disposition'] = 'filename=recibos.pdf'
return r
But I do not get good results Thank you in advance.
source
share