Django/Python: Show pdf in a template
<p>I'm using django 1.8 in python 2.7.</p>

<p>I want to show a pdf in a template.</p>

<p>Up to know, thanks to <a href="http://stackoverflow.com/a/29718326/1395874">MKM's answer</a> I render it in a full page. </p>

<p>Do you know how to render it?</p>

<p>Here is my code:</p>

<pre><code>def userManual(request):
    with open('C:/Users/admin/Desktop/userManual.pdf', 'rb') as pdf:
        response = HttpResponse(pdf.read(), content_type='application/pdf')
        response['Content-Disposition'] = 'inline;filename=some_file.pdf'
        return response
    pdf.closed
</code></pre>

<p>The ability to embed a PDF in a page is out of the scope of Django itself, you are already doing all you can do with Django by successfully generating the PDF, so you should look at how to embed PDFs in webpages instead:</p>

<p>Therefore, please check:</p>

<p><a href="http://stackoverflow.com/questions/291813/recommended-way-to-embed-pdf-in-html">Recommended way to embed PDF in HTML?</a></p>

<p><a href="http://stackoverflow.com/questions/14081128/how-can-i-embed-a-pdf-viewer-in-a-web-page">How can I embed a PDF viewer in a web page?</a></p>

python django pdf