1

Am using this PDF library https://github.com/thujohn/pdf-l4 to generate PDF in PHP (Laravel)

When I try something like:

$html = '<html>';
   $html .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
   $html .= '<body>مرحبا</body>';
$html .= '</html>';
return PDF::load( utf8_decode($html) , 'A4', 'portrait' )->show();

I get ????? as output instead of مرحبا

When I remove utf8_decode I get empty response.

Can anyone tell me how I can display Arabic characters in PDF using PHP .

Thanks in advance.

ikuchris
  • 1,162
  • 1
  • 15
  • 33
  • I had the same problem with polish letters: https://stackoverflow.com/questions/46772714/how-to-set-encoding-in-php-fpdi-library – Adam Kozlowski Mar 23 '18 at 08:22

1 Answers1

0

You can try this package, i used it before and it supports Arabic dompdf/dompdf

this comment on github explains all the steps

A. Dabak
  • 760
  • 1
  • 9
  • 23