result = StringIO.StringIO()
pdf = pisa.pisaDocument(StringIO.StringIO(html.encode('ISO-8859-1')), result)
if not pdf.err:
    return HttpResponse(result.getvalue(), content_type='application/pdf')
return HttpResponse('We had some errors<pre>%s</pre>' % escape(html))
Render HTML to PDF in Django site