Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TCPDF can't show cyrillic

Tags:

php

pdf

tcpdf

I'm trying to output cyrillic in pdf with TCPDF .

I tried using, UTF-8, Windows-1251. I had changed the Unicode to FALSE and TRUE, to test, but I'm getting only? I tried with default and with font from file, but same results, and I tried using setsubsettings, again, no result. What is wrong?

like image 308
V.Rashkov Avatar asked Feb 02 '12 21:02

V.Rashkov


2 Answers

Setting the font to freeserif did it for me - default/helvetica font: unreadable cyrillic characters; freeserif: readable Russian text.

// set default font subsetting mode
$pdf->setFontSubsetting(true);

// set font
$pdf->SetFont('freeserif', '', 12);

http://www.tcpdf.org/examples/example_008.phps

like image 141
anroots Avatar answered Nov 07 '22 01:11

anroots


Replace SetFont

$pdf->SetFont('dejavusans', '', 10);
like image 40
Srikanth Math Avatar answered Nov 07 '22 00:11

Srikanth Math