{"id":228,"date":"2015-04-16T07:55:13","date_gmt":"2015-04-16T07:55:13","guid":{"rendered":"http:\/\/angelwings.net\/blog\/?p=228"},"modified":"2015-04-16T07:55:13","modified_gmt":"2015-04-16T07:55:13","slug":"prestashop-1-6-pdf-invoice-encoding-issues-for-chinese-language","status":"publish","type":"post","link":"https:\/\/angelwings.net\/blog\/prestashop-1-6-pdf-invoice-encoding-issues-for-chinese-language\/","title":{"rendered":"Prestashop 1.6: PDF invoice encoding issues for Chinese language"},"content":{"rendered":"<p>File to change is located at classes\\pdf\\PDFGenerator.php<br \/>\nGenerally:<br \/>\nChange helvetica font.<br \/>\nDelete useless languages, leave only &#8216;zh&#8217; =&gt; &#8216;cid0cs&#8217;,<br \/>\nChange encoding.<br \/>\nThan on English language documents Chinese characters are displayed correctly (address, names, etc&#8230;.)<br \/>\nProbably it works for other languages too.<\/p>\n<p>Source: https:\/\/www.prestashop.com\/forums\/topic\/336709-presta-15-cant-display-chinese-characters-in-pdf-documents\/?p=1702105<\/p>\n<p><code>class PDFGeneratorCore extends TCPDF<br \/>\n{<br \/>\nconst DEFAULT_FONT = 'helvetica';<\/code><\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>public $header;<br \/>\npublic $footer;<br \/>\npublic $content;<br \/>\npublic $font;<\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>public $font_by_lang = array(<br \/>\n&#8216;ja&#8217; =&gt; &#8216;cid0jp&#8217;,<br \/>\n&#8216;bg&#8217; =&gt; &#8216;freeserif&#8217;,<br \/>\n&#8216;ru&#8217; =&gt; &#8216;freeserif&#8217;,<br \/>\n&#8216;uk&#8217; =&gt; &#8216;freeserif&#8217;,<br \/>\n&#8216;mk&#8217; =&gt; &#8216;freeserif&#8217;,<br \/>\n&#8216;el&#8217; =&gt; &#8216;freeserif&#8217;,<br \/>\n&#8216;en&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;vn&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;pl&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;ar&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;fa&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;ur&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;az&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;ca&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;gl&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;hr&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;sr&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;si&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;cs&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;sk&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;ka&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;he&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;lo&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;lv&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;tr&#8217; =&gt; &#8216;dejavusans&#8217;,<br \/>\n&#8216;ko&#8217; =&gt; &#8216;cid0kr&#8217;,<br \/>\n&#8216;zh&#8217; =&gt; &#8216;cid0cs&#8217;,<br \/>\n&#8216;tw&#8217; =&gt; &#8216;cid0cs&#8217;,<br \/>\n&#8216;th&#8217; =&gt; &#8216;freeserif&#8217;<br \/>\n);<\/p>\n<p><code><br \/>\n<\/code><\/p>\n<p><code>\tpublic function __construct($use_cache = false)<br \/>\n{<br \/>\nparent::__construct('P', 'mm', 'A4', true, 'UTF-8', $use_cache, false);<br \/>\n$this-&gt;setRTL(Context::getContext()-&gt;language-&gt;is_rtl);<br \/>\n}<br \/>\n<\/code><\/p>\n<p>Than change it like this:<\/p>\n<p><code><br \/>\nclass PDFGeneratorCore extends TCPDF<br \/>\n{<br \/>\nconst DEFAULT_FONT = 'cid0cs';<\/code><\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>public $header;<br \/>\npublic $footer;<br \/>\npublic $content;<br \/>\npublic $font;<\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>public $font_by_lang = array(<\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>&#8216;zh&#8217; =&gt; &#8216;cid0cs&#8217;<\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>);<\/p>\n<p><code><br \/>\n<\/code><\/p>\n<p><code>\tpublic function __construct($use_cache = false)<br \/>\n{<br \/>\nparent::__construct('P', 'mm', 'A4', true, 'gb2312', $use_cache, false);<br \/>\n$this-&gt;setRTL(Context::getContext()-&gt;language-&gt;is_rtl);<br \/>\n}<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>File to change is located at classes\\pdf\\PDFGenerator.php Generally: Change helvetica font. Delete useless languages, leave only &#8216;zh&#8217; =&gt; &#8216;cid0cs&#8217;, Change encoding. Than on English language documents Chinese characters are displayed correctly (address, names, etc&#8230;.) Probably it works for other languages too. Source: https:\/\/www.prestashop.com\/forums\/topic\/336709-presta-15-cant-display-chinese-characters-in-pdf-documents\/?p=1702105 class PDFGeneratorCore extends TCPDF { const DEFAULT_FONT = &#8216;helvetica&#8217;; public $header; public [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[105],"class_list":["post-228","post","type-post","status-publish","format-standard","hentry","category-ecommerce","tag-prestashop-1-6"],"_links":{"self":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/posts\/228","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/comments?post=228"}],"version-history":[{"count":0,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/posts\/228\/revisions"}],"wp:attachment":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/media?parent=228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/categories?post=228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/tags?post=228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}