尽管使用drawCentredString
正确显示阿拉伯文,但我无法在表中正确显示阿拉伯文
下面是一个例子:
from arabic_reshaper import reshape
from bidi.algorithm import get_display
def arabic(text):
return get_display(reshape(text))
# This works
_canvas.setFont("NotoNaskhArabic-Regular", 24)
_canvas.drawCentredString(x=A4[0] / 2 - 10, y=760, text=arabic("نص عربي"))
# But this doesn't work
_canvas.setFont("NotoNaskhArabic-Regular", 18)
_head = Table([ [arabic("نص عربي")] ])
_head.wrapOn(_canvas, 0, 0)
_head.drawOn(_canvas, 10, 700)
渲染后
您可以在这里找到一个示例:
https://github.com/abduhbm/python-flask-ar-pdf/blob/c76c9be5a9f996fed17ac0e19443ae9f5db022a0/api/endpoints/pdf.py#L43
相关问题 更多 >
编程相关推荐