Arabic in zend pdf

依然范特西╮ 提交于 2019-12-23 01:52:45

问题


I am new in Zend framework. Now I have a problem with Zend pdf. I am trying to make a pdf document which contains arabic as well as english. But I can't print arabic in zend.

Please help me with any tutorials or sample code links.


回答1:


This is still an issue in Zend_pdf I would recommend you to use TCPDF here is the link for that http://www.tcpdf.org/

Go through there examples

http://www.tcpdf.org/examples.php

If you still want to stick with zend pdf may this link be helpful.

http://devzone.zend.com/1064/zend_pdf-tutorial/




回答2:


//Apply font file(.ttf) for zend pdf. for example below will allow arabic language in pdf file.

$font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/d7133c37aa7eda77090163c25c4bb89a.ttf');

// Apply Arabic word having issue of right to left display word by calling following function.

function converttext($part)
{ 
if (strlen($part) != strlen(utf8_decode($part)))
{ 
  preg_match_all('/./us', $part, $ar);
  $part = join('', array_reverse($ar[0]));
}

  return $part;

}

//Still having problem then, apply alternate solution add the following line in head.

ini_set('default_charset', 'utf-8');


来源:https://stackoverflow.com/questions/14868149/arabic-in-zend-pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!