TCPDF UTF-8. Lithuanian symbols not showing up

TCPDF is quite tricky with utf8. Best way to achieve what you want is to embed the font in generated PDF file itself. You can use freeserif font from the TCPDF package, it contains all the utf8 symbols, shows absolutely any character of any language, but adds ~700kb to the output file. That's probably the easiest way to get symbols you need if file size doesn't matter.

You could also make your own font to embed, containing the characters you need. That's probably the best solution, keeping it universal and small in size, but is more complex.

Alternatively, you can relay on core fonts, which are taken from the system, and if not found, replaced by a substitute. This makes output file extremely light, but adds the necessity of font subsetting to obtain exotic chars. Personally I haven't had a success with this, so I still think embedding font is the best solution, which also happens to be more universal..


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);

there is a font included in the CPDF core fonts - dejavusans, it shows all the lithuanian characters. Just add the following:

$pdf->setHeaderFont(Array('dejavusans', '', 10, '', false));
$pdf->setFooterFont(Array('dejavusans', '', 8, '', false));
$pdf->SetFont('dejavusans', '', 10, '', false);