Search code examples
phpfpdf

Support for unicode characters in FPDF library


I am using the FPDF library to generate a pdf, I want to write Hindi and Marathi text in that but it display's only English text. I tried adding 'Devnagari' fonts using makeFont.php but still it doesn't work.Below is my code that adds text to a pdf

     $pdf->SetXY(0,210);
     $pdf->SetLeftMargin(28);
     $pdf->SetRightMargin(28);
     $pdf->AddFont('mangal','','mangal.php');
     $pdf->SetFont('mangal','',11);
     $pdf->Write(2,'खालील आपली भाषा');

This is what I am getting in PDF


Solution

  • I hade the same problem some years ago. I used then tFPDF and it solved the issue.

    You may want to try it? The tFPDF class-file and an example are provided there: http://www.fpdf.org/en/script/script92.php

    Have a nice day