I want to use Malayalam (an Indian language) fonts in a PDF file from a PHP application. How can I use Unicode fonts in TCPDF?
You need to set the $unicode
parameter on the TCPDF constructor to false and the $encoding
parameter to 'ISO-639-2'(Wiki says)
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, false, 'ISO-639-2', false);
or if the above doesn't work and if you got the malayalam font, set it this way.
$fontname = $pdf->addTTFfont('/path-to-font/malayalam.ttf', 'TrueTypeUnicode', '', 32);