PDF file with UTF-8 string
Hello, I have problems with display UTF-8 (or another national charmaps, like ISO-8859-2) strings (in czech language, for ex. "ěčř") in PDF file - some chars are not displayed. Please, how can I generate PDF file from UTF-8 strings with national characters?
This is my script:
<?php
include "Zend/Pdf.php";
$pdf = new Zend_Pdf();
$page1 = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
// Create new font
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HE LVETICA);
// Apply font
$page1->setFont($font, 36);
// I tried 2 ways, but both are bad - some characters are not displayed
$file = fopen("text.txt", "r");
$string = fread($file, filesize("text.txt")); //in text.txt is my "czech" string (bellow)
//$string = 'eěsšcčrřzžyýaáiíeéoó';
$page1->drawText($string, 72, 720, 'UTF-8');
$pdf->pages[] = $page1;
$pdf->save("test.pdf");
?>
THX for your HELP
|