ı want export to pdf file, but I have character problem ? charset utf-8 but the problem continues. ı am adding err.
views.py
def render_pdf_view(request):
template_path = ‘events/pdf1.html’
context = {‘myvar’: ‘this is your template context’}
# Create a Django response object, and specify content_type as pdf
response = HttpResponse(content_type=‘application/pdf’)
response[‘Content-Disposition’] = ‘attachment; filename=“report.pdf”’
# find the template and render it.
template = get_template(template_path)
html = template.render(context)
# create a pdf
pisa_status = pisa.CreatePDF(
html, dest=response)
# if error then show some funy view
if pisa_status.err:
return HttpResponse('We had some errors <pre>' + html + '</pre>')
return response
/////////////////////////////////////////////////////////
pdf1.html
<meta charset="UTF-8">
<meta http-equiv="Content Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
İSTANBUL TÜRKİYE