4

I am using Zend_Pdf class to create a PDF document.

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

I am not able to figure out the problem....?

I tried some code like

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

But it is not taking it and showing the same result.....!!!!!!

Please provide some code or links that helps me........

Thanks in advance.....

Pushpendra
  • 4,344
  • 5
  • 36
  • 64

2 Answers2

5

Thanks Zsub,

I got the solution using following code :

$text = $this->_font->encodeString($text, 'UTF-8');
Pushpendra
  • 4,344
  • 5
  • 36
  • 64
2

You probably write to a Zend_Pdf_Page using something like

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

Just add the encoding:

$page->drawText($text, $xpos, $ypos, 'UTF-8');
Zsub
  • 1,799
  • 2
  • 15
  • 28