我使用Magento1.4.2,在其自带的TTF文件不能很好地解析中文字符,TTF文件的位置在网站根目录下的/lib/LinLibertineFont/中。打印的中文字符都是这样的

解决方法:
1.在Windows下复制一个MSYHBD.TTF(微软雅黑)至网站根目录下的/lib/LinLibertineFont/中
2.修改app\code\core\Mage\Sales\Model\Order\Pdf\Abstract.php
- protected function _setFontRegular($object, $size = 7)
- {
-
- $font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . ‘/lib/LinLibertineFont/MSYHBD.TTF‘);
- $object->setFont($font, $size);
- return $font;
- }
-
- protected function _setFontBold($object, $size = 7)
- {
-
- $font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . ‘/lib/LinLibertineFont/MSYHBD.TTF‘);
- $object->setFont($font, $size);
- return $font;
- }
-
- protected function _setFontItalic($object, $size = 7)
- {
-
- $font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . ‘/lib/LinLibertineFont/MSYHBD.TTF‘);
- $object->setFont($font, $size);
- return $font;
- }
注:这里主要是讲解解决方法,实际修改请将上述方法写成插件的形式,不要破坏Magento的产品代码。
原文:http://blog.csdn.net/liangpei2008/article/details/7574694
Magento打印(配送单、退款单、发票)时PDF中的乱码问题
原文:http://www.cnblogs.com/sunsoftware/p/4526434.html