template = get_template('template_testing.html')
html = template.render(Context(data))
file = open('test.pdf', 'w+b')
pisaStatus = pisa.CreatePDF(html.encode('utf-8'), dest=file, encoding='utf-8')
file.seek(0)
pdf = file.read()
file.close()
return HttpResponse(pdf, 'application/pdf')
How can I convert a HTML Page to PDF using Django