My pdf can not generate in thai language

My pdf can not generate in thai language. How to fix this?

How can I add a font or language? Which file to edit?

Help me,please
Thank You

Please open the file application/helpers/mpdf_helper.php and replace

$mpdf->useAdobeCJK = true;
$mpdf->autoScriptToLang = true;

with

$mpdf->useAdobeCJK = true;
$mpdf->autoScriptToLang = true;
$mpdf->autoLangToFont = true;

and report back if this fixed the problem.

1 Like

I have searched the article. And do as you (Kovah) suggested and error message:

An uncaught Exception was encountered
Type: Mpdf\MpdfException

Message: Warning - You cannot set this font (C:\xampp\htdocs\ip\vendor\mpdf\mpdf\src\Config/../../ttfonts/Garuda.ttf) to use OTL, as it does not include OTL tables (or at least, not a GDEF table).

Filename: C:\xampp\htdocs\ip\vendor\mpdf\mpdf\src\TTFontFile.php

Line Number: 1350

Backtrace:

File: C:\xampp\htdocs\ip\vendor\mpdf\mpdf\src\TTFontFile.php
Line: 1129
Function: _getGDEFtables

File: C:\xampp\htdocs\ip\vendor\mpdf\mpdf\src\TTFontFile.php
Line: 292
Function: extractInfo

File: C:\xampp\htdocs\ip\vendor\mpdf\mpdf\src\Fonts\MetricsGenerator.php
Line: 24
Function: getMetrics

File: C:\xampp\htdocs\ip\vendor\mpdf\mpdf\src\Mpdf.php
Line: 3825
Function: generateMetrics

File: C:\xampp\htdocs\ip\vendor\mpdf\mpdf\src\Mpdf.php
Line: 4113
Function: AddFont

File: C:\xampp\htdocs\ip\vendor\mpdf\mpdf\src\Mpdf.php
Line: 12529
Function: SetFont

File: C:\xampp\htdocs\ip\vendor\mpdf\mpdf\src\Mpdf.php
Line: 19640
Function: SetDefaultFont

File: C:\xampp\htdocs\ip\vendor\mpdf\mpdf\src\Mpdf.php
Line: 14752
Function: setCSS

File: C:\xampp\htdocs\ip\application\helpers\mpdf_helper.php
Line: 97
Function: WriteHTML

File: C:\xampp\htdocs\ip\application\helpers\pdf_helper.php
Line: 259
Function: pdf_create

File: C:\xampp\htdocs\ip\application\modules\quotes\controllers\Quotes.php
Line: 193
Function: generate_quote_pdf

File: C:\xampp\htdocs\ip\index.php
Line: 325
Function: require_once

Help me,please
Thank You,
Kovah.

Download all of the “Garuda” fonts from here and place them in the C:\xampp\htdocs\ip\vendor\mpdf\mpdf\ttfonts\ folder.

2 Likes

Wow , i can use it thanks a lot. :+1:

If I want to change the font ,What should I do
Please tell me how.

Help me,please
Thank You,
Kovah.

Changing the font is sadly somewhat complex and you would have to change several files.
The official reference: https://mpdf.github.io/fonts-languages/fonts-in-mpdf-7-x.html