$mpdf = new Mpdf([
'mode' => 'utf-8',
'fontDir' => array_merge((new ConfigVariables())->getDefaults()['fontDir'], [
public_path('fonts/'),
]),
'fontdata' => (new FontVariables())->getDefaults()['fontdata'] + [
'nikosh' => [
'R' => 'Nikosh.ttf',
'useOTL' => 0xFF,
],
],
'default_font' => 'nikosh',
]);
$mpdf->WriteHTML(view('backend.job_circular.test', $data)->render());
$fileName = time() . '_' . Str::random(10) . '.pdf';
$directory = public_path("uploads/{$subdomain}/{$path}/");
if (!file_exists($directory)) {
mkdir($directory, 0755, true);
}
$mpdf->Output($directory . $fileName, Destination::FILE);
public_path(‘fonts/’), this will be your path of fonts. ‘R’ => ‘Nikosh.ttf’,
this is font name of this path