Problems with the Zend_Pdf font with the German language .....?

I am using the Zend_Pdf class to create a PDF document .

Here the content is in the GERMAN language . Therefore, when I write the contents in pdf, automatically converts those characters to some special chars .

I can not understand the problem ...?

I tried code like

 $str = html_entity_decode($str, ENT_COMPAT, "UTF-8"); 

But he does not accept it and showing the same result ..... !!!!!!

Please provide the code or links that help me ........

Thanks in advance.

+4
source share
2 answers

Thanks Zsub,

I got the solution using the following code:

 $text = $this->_font->encodeString($text, 'UTF-8'); 
+5
source

You are probably writing to Zend_Pdf_Page using something like

 $page->drawText($text, $xpos, $ypos); 

Just add the encoding:

 $page->drawText($text, $xpos, $ypos, 'UTF-8'); 
+2
source

Source: https://habr.com/ru/post/1342296/


All Articles