2

在使用阿拉伯语文本时,我无法通过 python 中的 forge_fdf 函数以 pdf 形式编写阿拉伯语文本

reportlab.pdfgen import canvas

但是canvas不支持填写pdf表格。

查看我的代码

pdf_file = currentpath+ "test1.pdf"
tmp_file = currentpath+ "data.pdf"
output_file  = currentpath+ "output.pdf"

name = u'Ahmad said "السلام عليكم" (as-salaam alaykum] to me.'
fields = [('name', name), ('email', 'a السلام عليكم a'), ('phone', 'a السلام عليكم a'), ('rd','female'),('chk','Yes'),('chk2','Yes')]

fdf = forge_fdf("", fields, [], [], [])
fdf_file = open(tmp_file,"w")

fdf_file.write(fdf)
fdf_file.close()

cmd = 'pdftk "{0}" fill_form "{1}" output "{2}"  flatten'.format(pdf_file, tmp_file, output_file);
os.system(cmd)

当我运行此代码 pdf 表单填充但阿拉伯文本未显示并且所有英语都正确显示时。

我也在使用编码但没有成功

有没有人能做到这一点............

4

0 回答 0