Новый шрифт не применяется в tcpdf

0
I have an HTML to convert into pdf using TCPDF library as below,

require_once('tcpdf/tcpdf_include.php');

// create new PDF document'enter code here'
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// convert TTF font to TCPDF format and store it on the fonts folder
$fontname1 = $pdf->addTTFfont('tcpdf/fonts/2C83A2_0_0.ttf', 'AzoWeb-Bold');
// use the font
$pdf->AddFont($fontname1, '', 14, '', false);
$html = '<div style="font-family: \'AzoWeb-Medium\';">Testing new fonts</div>';

//echo $html;exit; 
$pdf->AddPage();

// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');

//Close and output PDF document
$pdf->Output("example1.pdf", 'I');

Шрифт не применяется в HTML и возвращает ошибку файла определения шрифта. Есть ли кто-нибудь, кто может помочь?

Теги:
fonts
tcpdf

1 ответ

1

Обновление с помощью SetFont(),

// convert TTF font to TCPDF format and store it on the fonts folder
$fontname1 = $pdf->addTTFfont('tcpdf/fonts/2C83A2_0_0.ttf', 'AzoWeb- Bold',   '', 96);
// use the font
$pdf->SetFont($fontname1, '', 14, '', false);

Ещё вопросы

Сообщество Overcoder
Наверх
Меню