阿拉伯语的tcpdf将字符显示为问号'?????? ???' [英] tcpdf for Arabic display the characters as question marks '?????? ???'
问题描述
我想创建一个阿拉伯文pdf文件,就像我以ms Execl格式保存的文件一样.在php中使用tcpdf创建pdf时,阿拉伯字符显示为'????'.标记.
I wanna create an Arabic pdf as same as the file witch I had in ms Execl format. While creating the pdf using tcpdf in php the Arabic charactors are displyaed as '????' marks.
字符是从我的excel文件中复制的
The characters are copied from my excel file
$htmlcontent2 = '<span color="#0000ff">"مجوهرات السليمان"This is Arabic "مجوهرات السليمان" Example With TCPDF.</span>';
$ pdf-> WriteHTML($ htmlcontent2,true,0,true,0);
$pdf->WriteHTML($htmlcontent2, true, 0, true, 0);
输出文件显示如下,
??? ???? ?????? ??????这是阿拉伯语"?????????????????????" 使用TCPDF的示例.
??? ???? ?????? ??????This is Arabic "??????? ????????" Example With TCPDF.
推荐答案
我通过添加以下行来解决此问题:
I solved this issue by adding the following line:
$pdf->SetFont('aealarabiya', '', 18);
原来,您需要设置适当的字体类型才能删除那些难看的字体????字符.
It turned out that you need to set the proper font type to remove those ugly ????? characters.
此 链接 中提到的范例非常有用解决这个问题.
The exmaple mentioned in this link was very useful to solve this issue.
这篇关于阿拉伯语的tcpdf将字符显示为问号'?????? ???'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!