我已经使用 Django-pisa 生成了一个 pdf .. PDF 内容取自正确对齐的数据库,但无法在 PDF 上正确完成....
我用过:
filename = "/home/anoop/DjangoCodes/hello.pdf"
c = '''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<style type="text/css">
@font-face {font-family: code2000;src: url(dhivehi.otf.ttf);}
html {font-family: code2000;dir: rtl;unicode-bidi:bidi-override;}
</style>
</head><body><div dir='rtl'>%s</div></body></html>''' % content_text
print c
pdf = pisa.CreatePDF(c,file(filename, "wb"))
if not pdf.err:
pisa.startViewer(filename)
content_text 包含 dhivehi 文本..
示例:content_text:އެގޮތުންއެގޮތުންމަރަދޫމަރަދޫފޭދޫއާއިއަށްވެސްއުދަކަމަށްކަމަށް
text in pdf: ށަމަކ ާވިއަފާރައ ަދުއ ްސެވްށައ ޫދޭފ ިއާއ ޫދޭފޫދަރަމ ިއާއ ޫދަރަމ ެގޫޑްއައ ްނުތޮގެއ