【发布时间】:2022-07-28 18:58:03
【问题描述】:
我在我的 Laravel 应用程序中使用 mPDF。我的 pdf 文件带有英语和马拉雅拉姆语两种语言。但马拉雅拉姆语内容无法正确加载。我尝试添加新字体,但它总是显示missing OTL table 错误。这是我的代码。
配置/pdf.php
return [
'mode' => 'utf-8',
'format' => 'A4',
'author' => '',
'subject' => '',
'keywords' => '',
'creator' => 'Laravel Pdf',
'display_mode' => 'fullpage',
//'tempDir' => base_path('../temp/'),
'tempDir' => __DIR__.'/../temp/',
//'tempDir' => __DIR__.'/../storage/framework/pdf/',
'pdf_a' => false,
'pdf_a_auto' => false,
'icc_profile_path' => '',
'font_path' => base_path('resources/fonts/'),
'font_data' => [
'malayalam' => [
'R' => 'ECBThinkal.ttf', // regular font
'B' => 'ECBThinkal.ttf', // optional: bold font
'I' => 'ECBThinkal.ttf', // optional: italic font
'BI' => 'ECBThinkal.ttf', // optional: bold-italic font
'useOTL' => 0xFF,
'useKashida' => 75,
]
]
];
view.blade.php
<html>
<?php header('Content-Type: text/html; charset=utf-8');?>
<head>
<style>
body {
font-family: 'malayalam', sans-serif;
}
</style>
我没有粘贴完整的代码。当我尝试创建 pdf 时,它返回错误 Unable to set font "D:\xampp\htdocs\xxxxx\resources/fonts//ECBThinkal.ttf" to use OTL as it does not include OTL tables (or at least not a GDEF table).
也尝试了一些其他字体,但仍然显示此错误。
【问题讨论】: