Im using latest TCPDF version(5.9). But have some strange problems with encoding. I need Lithuanian language symbols like: ąčęėįšųūž. But get only few of it. Other remain li
I had the same issue with Romanian characters and the problem wasn't the encoding, LC_CTYPE or other setting from TCPDF, but the font I used. I mention that I used TWIG templating with Courier font. You can try to change your font to freeserif
change the font to show normally ₹ and Lithuanian symbols
$pdf->SetFont('cid0cs', '', 12);
You u have problem to read character like Karnātaka from database and display like this karn?taka I mean "?" which we don't want then do following things :
Define charset for the connection (mysql_set_charset()):
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database_name", $con) or die(mysql_error());
mysql_set_charset('utf8',$con);
Use $pdf->SetFont('DejaVuSerif', '', 10); instead of $pdf->SetFont('helvetica', 'B', 12);
$fontname = $pdf->addTTFfont('C:\xampp\htdocs\copyshop\fonts\07-TH-Sarabun-PSK\THSarabun.ttf', 'TrueTypeUnicode', '', 32);
$pdf->SetFont($fontname, '', 16,'',FALSE); //Working
Set the $unicode parameter on the TCPDF constructor to false and the $encoding parameter to 'ISO-8859-1' or some other character map.
This will help you:
Default for UTF-8 unicode:
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
Example of constructor for European charset:
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, false, 'ISO-8859-1', false);
With dejavusans font it worked fine for both Russian and Latvian letters.