You could add new font with proper letters
$pdf->AddFont('DejaVu','','DejaVuSansCondensed.php');
$pdf->SetFont('DejaVu', '', 10, '', false);
Then in regard to FPDF
library that is used by FPDI
:
There possible encodings are:
cp1250 (Central Europe)
cp1251 (Cyrillic)
cp1252 (Western Europe)
cp1253 (Greek)
cp1254 (Turkish)
cp1255 (Hebrew)
cp1257 (Baltic)
cp1258 (Vietnamese)
cp874 (Thai)
ISO-8859-1 (Western Europe)
ISO-8859-2 (Central Europe)
ISO-8859-4 (Baltic)
ISO-8859-5 (Cyrillic)
ISO-8859-7 (Greek)
ISO-8859-9 (Turkish)
ISO-8859-11 (Thai)
ISO-8859-15 (Western Europe)
ISO-8859-16 (Central Europe)
KOI8-R (Russian)
KOI8-U (Ukrainian)
The string that was sent to pdf was in UTF-8 (it was checked by mb_detect_encoding
function) and there was a need to convert it with cp1250.
$str = iconv('UTF-8', 'cp1250', 'zazółcić gęślą jaźń');
Another solution would be to try to use:
$pdf->SetFont('freeserif', '', 14, '', true);
UPDATE PRO TIP:
In case of problems with fonts - check out first if the font is installed on your linux server.
FPDI
library uses eitherFPDF
,TCPDF
, ortFPDF
in order to add PDF file importing support to them. FPDF does not support UTF-8 encoding.tFPDF
is a replacement forFPDF
, that adds UTF-8 support. However you will still need to add your UTF-8 fonts manually or to yourfonts/unifont
directory. – Usa'mode' => 'utf-8'
. May take a look – Krute