Bangla Font in PDF Laravel(MPDF Package)

Bangla font in pdf in Laravel using mpdf

Bangla Font in PDF Laravel(MPDF Package).In this tutorial we will learn step by step process how to download bangla font as pdf without having no font breakdown.For that we will use mPDF package.We can use many package for pdf like DomPDF but in DomPDF it has given font error For bangla font.For that we will use mPDF and it will give beautiful bangla font in pdf file.

Following are the steps

  1. Require this package in your composer.json
  2. Run on terminal
  3. Add following in config/app.php
  4. Run on terminal
  5. Search ‘nikosh ttf’’ ,go to https://www.omicronlab.com/bangla-fonts.html , A file called Nikosh.ttf will be downloaded,Then go to project/vendor\mpdf\mpdf\ttfonts directory and paste this .ttf filebangla font in pdf package laravel-mpdf
  6. Go to project/vendor/mpdf/mpdf/src/Config/FontVariables.php ,open FontVariables.php and search for ‘indics’ ,then after pothana2000 ,add follwoing code

    or

  7. Go to project/config/ and create pdf.php
  8. Laravel controller ,add
  9. Laravel controller function

    Here Employee_History.empdata.pdfview_emp_his =projectfolder/resources/view/Employee_History/empdata/pdfview_emp_his.blade.pdf or the  view of pdf
    ’empresult’,’dateformatMMYY’,’result’ are data from query ,MPDF::loadView= it will load the view of pdf with data[compact]

    return $pdf->download(‘document.pdf’); here download will help to download the file and  ‘document.pdf’ will be the filename of downloaded PDF

For package info https://packagist.org/packages/carlos-meneses/laravel-mpdf

 

Share with:


Comments are closed.