How to use bangla font when Generating pdf using Mpdf (Laravel)

802 Views Asked by At

I am trying to write Bengoli in my pdf which i am generating by MPDF library.

$mpdf = new \Mpdf\Mpdf([

            
            'margin_top'=>10,
            'margin_buttom'=>10,


        ]);

there is no errors , external fonts which i am trying to use for Bengoli is not effecting my content,I have tried DejaVu Sans it works for few languages but can't figure out which will work for bengoli, I have both english and Bengoli content in same page so when i use other fonts or external fonts i get ?????????? [][[][][][][][], English content is ok with other fonts but for bengoli nothing seems to work.

1

There are 1 best solutions below

0
On BEST ANSWER

After lots searching i have found a simple solution for my project, which is to use FreeSerif which is already included in mpdf.

    $mpdf = new \Mpdf\Mpdf([

        'default_font' => 'FreeSerif',
        'mode' => 'utf-8',
        'margin_top'=>10,
        'margin_buttom'=>10,


    ]); 

I have added below two lines :

    'default_font' => 'FreeSerif',
        'mode' => 'utf-8',

when initializing mpdf.