I have problems outputting UTF-8 characters into pdf file with Zend_Pdf. Here is my code:
// Load Zend_Pdf class
include 'Zend/Pdf.php';
// Create new PDF
$pdf = new Zend_Pdf();
// Set font
$page->setFont(Zend_Pdf_Font::fontWithPath('fonts/times.ttf'), 12);
// Draw text
$page->drawText('Janko Hraško', 200, 643, 'UTF-8');
The font I§m loading supports UTF-8 characters. But I am getting this error"
Notice: iconv() [function.iconv]: Detected an illegal character in input string in D:\\data\\o\\Zend\\Pdf\\Resource\\Font\\Type0.php on line 241
使用Helvetica字体,您的代码可以正常工作!
Solved:
$page->drawText('Janko Hraško', 200, 643, 'Windows-1250');
For some reason, Windows-1250 encoding works but UTF-8 doesn't. Weird but I will use Windows-1250 then.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.