First you need to generate a font. You must use the MakeFont utility included in the FPDF package. I used on Linux this is a slightly extended script from the demo:
<?php // Generation of font definition file for tutorial 7 require('../makefont/makefont.php'); $dir = opendir('/usr/share/fonts/truetype/ttf-dejavu/'); while (($relativeName = readdir($dir)) !== false) { if ($relativeName == '..' || $relativeName == '.') continue; MakeFont("/usr/share/fonts/truetype/ttf-dejavu/$relativeName",'ISO-8859-2'); } ?>
Then I copied the generated files to the font directory of my website and used this:
$pdf->Cell(80,70, iconv('UTF-8', 'ISO-8859-2', 'Buňka jedna'),1);
(I worked on the table.) It worked in my language (Buňka jedna - Czech for Cell one). Czech belongs to the central European languages, also ISO-8859-2. Unfortunately, the FPDF user is forced to lose the benefits of UTF-8 encoding. You cannot get this in your PDF file:
Městečko Fruens Bøge
The Danish letter ø becomes ř in ISO-8859-2.
Solution suggestion: You need to get the Greek font, generate the font using the correct encoding (ISO-8859-7) and use iconv with the same target encoding as the font was generated with.
Tomáš K. Apr 10 2018-12-12T00: 00Z
source share