我试着用阿拉伯语创建pdf报告几周,但我失败了 . 我使用ReportLab和两个包来构建阿拉伯字符,即bidi.algorithm和arabic_reshaper . 在控制台中,角色组织良好,但在pdf中只有黑色方块 .
import reshaper
from bidi.algorithm import get_display
heading = get_display(reshaper.reshape(unicode('العربية', encoding='utf-8')))
print heading
控制台中的输出:العربية
但是在生成的pdf文件中:▀▀▀▀▀
先感谢您 .
1 回答
我遇到了同样的问题,并提出了以下解决方案:
然后你必须setFont'阿拉伯语 - 粗体'在pdf文件中显示它 .