python中的阿拉伯信件
是否可以使用Borb
编写阿拉伯语字母?
我尝试了borb
中的14个可能的字体,其中没有一个能够显示阿拉伯语字母。
from borb.pdf import Document
from borb.pdf import PDF
from borb.pdf import Page
from borb.pdf import Paragraph
from borb.pdf import SingleColumnLayout
def main():
# Create an empty Document.
pdf = Document()
# Add an empty Page.
page = Page()
pdf.append_page(page)
# Use a PageLayout (SingleColumnLayout in this case).
layout = SingleColumnLayout(page)
# Add a Paragraph
layout.add(Paragraph("Hello World", font="Helvetica"))
# Store the PDF.
with open(Path('output.pdf'), 'wb') as pdf_file_handle:
PDF.dumps(pdf_file_handle, pdf)
Is it possible to write Arabic letters using borb
?
I have tried the 14 possible fonts in borb
and no one of them was able to display the Arabic letters.
from borb.pdf import Document
from borb.pdf import PDF
from borb.pdf import Page
from borb.pdf import Paragraph
from borb.pdf import SingleColumnLayout
def main():
# Create an empty Document.
pdf = Document()
# Add an empty Page.
page = Page()
pdf.append_page(page)
# Use a PageLayout (SingleColumnLayout in this case).
layout = SingleColumnLayout(page)
# Add a Paragraph
layout.add(Paragraph("Hello World", font="Helvetica"))
# Store the PDF.
with open(Path('output.pdf'), 'wb') as pdf_file_handle:
PDF.dumps(pdf_file_handle, pdf)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您需要使用自定义字体,即已经在计算机上的阿拉伯字体,或者是从 Google字体。
以下是一个示例,使用 ibm plex sans sans sans sans asans ass aberic :
I think you will need to use a custom font, either an Arabic font already on your computer or a downloaded one from something like Google Fonts.
Below is an example using IBM Plex Sans Arabic: