Closed lutek closed 5 years ago
with fix work fine:
$defaultFontConfig = (new \Mpdf\Config\FontVariables())->getDefaults();
$fontData = $defaultFontConfig['fontdata'];
$path = Yii::getAlias('@app/data/pdf/');
$targetFile = $path . $model->qr_key . '.pdf';
$options = [
'fontDir' => '@app/data/fonts/',
'fontdata' => $fontData + [
'Roboto' => [
'R' => 'Roboto-Regular.ttf',
'I' => 'Roboto-Italic.ttf',
'B' => 'Roboto-Bold.ttf',
]
],
'default_font' => 'Roboto',
];
Yii::$app->html2pdf
->convert($html, $options)
->saveAs($targetFile);
Resolved by commit c68115bfc4016cd4bc287037bfd17d9526100dce
https://github.com/yii2tech/html2pdf/issues/17