vendor\tecnickcom\tcpdf\config\tcpdf_config.php 做以下更改(msyh 已经导入fonts文件夹了),导出中文还是乱码
require_once DIR . ‘/…/examples/lang/chi.php’;
define (‘PDF_FONT_NAME_MAIN’, ‘msyh’);
define (‘PDF_FONT_NAME_DATA’, ‘msyh’);
检查您是否拥有该目录或文件。此外,请检查文件权限和所有权。
目录文件都是正确的,下载的英文pdf是正常的,只有中文内容的pdf是乱码
那一定是中文包的问题。
不是中文包的问题,中文直接从db读取的,在系统中显示正确,在pdf中显示 口口 ??
Can we please use the officially available forum languages? English, Spanish, Russian, German
So that everyone can benefit from the discussions.
Thank you and sorry for not supporting more languages…
非常感谢您们,我已经解决了,更改 ** **modules\AOR_Reports\controller.php****中pdf的默认字体。
Did you update this code?
‘mode’ => ‘en’,
ob_clean();
try {
$pdf = PDFWrapper::getPDFEngine();
$pdf->configurePDF([
'mode' => 'en',
'font' => 'DejaVuSansCondensed',
]);
$pdf->addCSS($stylesheet);
$pdf->writeFooter($footer);
$pdf->writeHTML($head, 2);
$pdf->writeHTML($report, 3);
$pdf->outputPDF($this->bean->name . '.pdf', 'D');
} catch (PDFException $e) {
LoggerManager::getLogger()->warn('PDFException: ' . $e->getMessage());
}