Bangla Font showing mismatch – Laravel Dompdf

  bangla-font, dompdf, fonts, laravel, laravel-7

I am using Laravel Dompdf to generate PDF. Use Kalpurush font for Bangla text. Everything working well but text showing mismatch into PDF view. Lets example:Text should be আমি comes out like আ ম ি .
I don’t know how can solve this problem. Already used UTF-8 charset. Here is my code sample

$pdf = PDF::setOptions(['dpi' => 150, 'defaultFont' => 'Kalpurush'])->loadView('text.download', compact('data'));

<!DOCTYPE html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
   <style>

       @font-face {
            font-family: "Kalpurush";
            src: url({{ storage_path('fonts/Kalpurush.ttf') }}) format('truetype');
        }

        body { font-family: "Kalpurush", DejaVu Sans;}

  </style>

Have anyone face this type of problem.
Please give me guideline or any solution to solve this Bangla font problem for Lavavel Dompdf.

Source: Laravel

Leave a Reply