tcpdf for Arabic display the characters as question marks '?????? ???'

三世轮回 提交于 2019-12-07 07:49:40

问题


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.

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);

the output file display as below,

??? ???? ?????? ??????This is Arabic "??????? ????????" Example With TCPDF.


回答1:


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.




回答2:


I solved this issue by following this step:

  1. Download TCPDF from here: http://sourceforge.net/projects/tcpdf/
  2. Open the TCPDF file after download and go to FONTS
  3. Copy these files

    • aealarabiya.ctg.z

    • aealarabiya.z

    • aealarabiya.php

  4. Paste in this location: your WHCMS root / includes/fonts if fonts folder doesn't exist create it.

  5. Go to WHCMS Admin Panel Got to WHMCS Set Up / General Setting / Invoice / TCPDF Font Family / custom (aealarabiya)



回答3:


there might be issue with your character set in your code

here is very good example for official TCPDF to use arabic character to write new pdf.

just go throw this example with your application you can sure solve your issue.

hope this will help to you.



来源:https://stackoverflow.com/questions/17966543/tcpdf-for-arabic-display-the-characters-as-question-marks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!