Lưu ý: sao lưu các file trước khi sửa đổi
Các bước thực hiện 1. Download TCPDF về, FPDF không hỗ trợ Unicode nên sử dụng TCPDF thay thế.
Link download TCPDF: TCPDF at Sourceforge
2. Bung TCPDF vào thư mục Tools, cùng chỗ với FPDF
3. Sửa 3 file sau đây:
config\config.inc.php: thêm 1 dòng
+ classes\PDF.php:define('_PS_TCPDF_PATH_', _PS_TOOL_DIR_.'tcpdf/');
- dòng 15:
include_once(_PS_TCPDF_PATH_.'tcpdf.php');
class PDF extends TCPDF
parent::__construct($orientation, $unit, $format, true, 'UTF-8');
$pdf->getAliasNbPages();
$this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']).' - '.self::l('Customized'), 'B', 'L');
$this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']), 'B', 'L');
return $font ? $font : 'freesans';
comment toàn bộ code của hàm này và return $string luôn. Cụ thể:
static public function iconv($from, $to, $string){ //$converted = htmlentities($string, ENT_NOQUOTES, $from); //$converted = html_entity_decode($converted, ENT_NOQUOTES, $to); //return $converted; return $string;}Cách này sẽ cho ra file PDF hiển thị được tiếng Việt khi click vào link.
Tuy nhiên file PDF configuration trong Back Office chưa hiển thị được tiếng Việt
và sẽ được cập nhật sau.
Muốn đổi font thì sửa code trực tiếp (xem dòng 708 ở trên).
Blogger Comment
Facebook Comment