阿拉伯语的 tcpdf 将字符显示为问号 '?????????' [英] tcpdf for Arabic display the characters as question marks '?????? ???'

查看:47
本文介绍了阿拉伯语的 tcpdf 将字符显示为问号 '?????????'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个与我拥有的 ms Execl 格式的文件相同的阿拉伯语 pdf.在 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆