return pdf response from stdout with Django
I am using wkhtmltopdf to create PDF files, how ever I don't know how to return them properly, so I had to write them to my media folder and then redirect to the just created file. Edit: Ian's advice is to write to STDOUT, so I have changed my wkhtmltopdf command to do that, but now I don't know how to return that content. I have been trying using subprocess.Popen this way: r = HttpResponse(Popen(command_args), mimetype='application/pdf') r['Content-Disposition'] = 'filename=recibos.pdf' return r But I am not getting good results Thanks in advance. You should open your sub command like so: