问题描述
test.PHP:
<?PHP
require_once('./vendor/autoload.PHP');
use \Mpdf\Mpdf;
use \Mpdf\Config\ConfigVariables;
use \Mpdf\Config\Fontvariables;
use \Mpdf\Output\Destination;
$defaultConfig = (new ConfigVariables())->getDefaults();
$fontDirs = $defaultConfig['fontDir'];
$defaultFontConfig = (new Fontvariables())->getDefaults();
$fontData = $defaultFontConfig['fontdata'];
$mpdf = new Mpdf(
[
'tempDir' => sys_get_temp_dir(),'mode' => 's','fontDir' => array_merge($fontDirs,[
'./static/fonts',]),'fontdata' => $fontData +
[
'noto_sans' =>
[
'R' => 'NotoSans-Regular.ttf','I' => 'NotoSans-Italic.ttf','B' => 'NotoSans-Bold.ttf','BI' => 'NotoSans-BoldItalic.ttf','E' => 'NotoColorEmoji.ttf',],'noto_color_emoji' =>
[
'R' => 'NotoColorEmoji.ttf','default_font' => 'noto_sans','backupSubsFont' =>
[
'noto_sans','noto_color_emoji','useSubstitutions' => true,'charset-in' => 'utf-8',]);
$mpdf->WriteHTML("?");
$temp_pdf_file = "./test.pdf";
$mpdf->Output($temp_pdf_file,Destination::FILE);
PHP Notice: Undefined offset: 48400 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4122
PHP Notice: Undefined offset: 48401 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4123
PHP Notice: Undefined offset: 21826 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4122
PHP Notice: Undefined offset: 21827 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4123
PHP Notice: Undefined offset: 53970 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4122
PHP Notice: Undefined offset: 53971 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4123
PHP Notice: Undefined offset: 18189 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4122
PHP Notice: Undefined offset: 18190 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4123
PHP Warning: unpack(): Type n: not enough input,need 2,have 0 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4379
PHP Warning: unpack(): Type n: not enough input,have 0 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4379
PHP Notice: Undefined offset: 48400 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4365
PHP Notice: Undefined offset: 48401 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4366
PHP Notice: Undefined offset: 21826 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4365
PHP Notice: Undefined offset: 21827 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4366
PHP Notice: Undefined offset: 53970 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4365
PHP Notice: Undefined offset: 53971 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4366
PHP Notice: Undefined offset: 18189 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4365
PHP Notice: Undefined offset: 18190 in /home/kenny/test/vendor/mpdf/mpdf/src/TTFontFile.PHP on line 4366
test.pdf 有一个“豆腐”字符。
mPDF 是 v8.0.11,PHP 是 v7.2.24。此时更改 PHP 版本是不可行的。 ASCII 覆盖的字符可以正常工作。 CJK 字符没有,但我还没有这些字体,所以这并不奇怪。
编辑:我在每个 this 线程中尝试了 mbstring.func_overload = 0
,但没有任何改变。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)