I'm using DOMPDF ver. 0.7.0 to make a pdf file from HTML, but I have problem when I need to use custom font (arial) with bold style. the bold font won't work after rendering.
here's the CSS style I'm using now:
@font-face {
font-family: 'font';
font-style: normal;
font-weight: normal;
src: url(dompdf/font/arial.ttf);
}
@font-face {
font-family: 'font';
font-style: normal;
font-weight: bold;
src: url(dompdf/font/arialbd.ttf);
}
body{
font-family: 'font';
}
and here's dompdf - php code:
require_once 'dompdf/autoload.inc.php';
use Dompdf\Dompdf;
$dompdf = new Dompdf();
$dompdf->load_html($html);
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$pdf = $dompdf->output();
file_put_contents('pdf/sptjm.pdf', $pdf)
the pdf didn't show the bold type, please help. thanks in advance.
i have done it simply with using different font name:
@font-face {
font-family: 'font';
font-style: normal;
font-weight: normal;
src: url(dompdf/font/arial.ttf);
}
@font-face {
font-family: 'font2';
font-style: normal;
font-weight: bold;
src: url(dompdf/font/arialbd.ttf);
}
body{
font-family: 'font';
}
so when i need the bold font type, just simply call the other font name 'cuz basically it is different font source.