1
reportlab pisa를 사용하여 한자를 표시하려고합니다. 생성 된 중국어 단어는 검은 색 블록이됩니다. 난 당신이 표시해야 글꼴은 PDF로 reportlabs하여 임베드하지 무엇이든으로 PDF 파일검정색 블록으로 중국어 문자를 표시하는 pisa django
def render_to_pdf(template_src, context_dict):
"""Function to render html template into a pdf file"""
template = get_template(template_src)
context = Context(context_dict)
html = template.render(context)
result = StringIO.StringIO()
pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("UTF-8")), result)
if not pdf.err:
return HttpResponse(result.getvalue(), mimetype='application/pdf')
return HttpResponse('We had some errors<pre>%s</pre>' % escape(html))
확실히 중국어 문자가 부족한 글꼴입니다. –
어떻게 글꼴을 사용해야하는지 혼란 스럽습니다. 나는 Pisa 문서에서 html 템플릿 (내가 쓸모 없게 만들었습니다)에서이 작업을 수행 할 수 있음을 알 수 있습니다. 그리고 나는 reportlab로 어떻게이 일을 할 수 있는지 잘 모르겠습니다. –