Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 541
user2637408 Avatar asked Dec 16 '22 08:12

user2637408


2 Answers

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.

like image 75
Ma'moon Al-Akash Avatar answered Dec 21 '22 22:12

Ma'moon Al-Akash


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)
like image 26
Mohamed Fadlaoui Avatar answered Dec 21 '22 23:12

Mohamed Fadlaoui