How to fix the garbled Chinese characters in invoice?
Have you encountered an issue that the Chinese characters in invoice are garbled? Some of the people reported to us and they need to buy a module for this problem. Actually you just need to change a line of code and it will be fixed. Since we usually use Linux server to host the Prestashop. In server, open a terminal and type the following command to make some change in a program file.
sudo nano /applicationfolder/classes/pdf/pdfgenerator.php
There are two options for applying Chinese fonts
1/. and in line 30 replace all “helvetica” into “kozminproregular”
2/. If first option doesn’t work, you can use cid0cs instead. To display Chinese characters in English Invoice PDF, you need to change ‘en’ => ‘cid0cs’.
class PDFGeneratorCore extends TCPDF
{
const DEFAULT_FONT = ‘cid0cs‘;
public $header;
public $footer;
public $pagination;
public $content;
public $font;
public $font_by_lang = array(
‘ja’ => ‘cid0jp’,
‘bg’ => ‘freeserif’,
‘ru’ => ‘freeserif’,
‘uk’ => ‘freeserif’,
‘mk’ => ‘freeserif’,
‘el’ => ‘freeserif’,
‘en’ => ‘cid0cs’,
‘vn’ => ‘dejavusans’,
‘pl’ => ‘dejavusans’,
‘ar’ => ‘dejavusans’,
‘fa’ => ‘dejavusans’,
‘ur’ => ‘dejavusans’,
‘az’ => ‘dejavusans’,
‘ca’ => ‘dejavusans’,
‘gl’ => ‘dejavusans’,
‘hr’ => ‘dejavusans’,
‘sr’ => ‘dejavusans’,
‘si’ => ‘dejavusans’,
‘cs’ => ‘dejavusans’,
‘sk’ => ‘dejavusans’,
‘ka’ => ‘dejavusans’,
‘he’ => ‘dejavusans’,
‘lo’ => ‘dejavusans’,
‘lt’ => ‘dejavusans’,
‘lv’ => ‘dejavusans’,
‘tr’ => ‘dejavusans’,
‘ko’ => ‘cid0kr’,
‘zh’ => ‘cid0cs’,
‘tw’ => ‘cid0cs’,
‘th’ => ‘freeserif’,
);
Before fixing
After fixing
Related Post
Introduction to ManyChat Builder (Block Type)
Deprecated: Function create_function() is deprecated in /opt/lampp/htdocs/genkiware/wp-content/themes/optima/single.php on line 185
There are many blocks we can add to our messages…
Prestashop one click upgrade to latest version
Deprecated: Function create_function() is deprecated in /opt/lampp/htdocs/genkiware/wp-content/themes/optima/single.php on line 185
Many users have a concern about the latest version upgrade.…