D
D
Diversia2017-01-10 11:09:31
PHP
Diversia, 2017-01-10 11:09:31

How to include Calibri font in tcpdf?

Hello.
I can't figure out how to include the Calibri font in tcpdf?
Downloaded the Calibri.ttf file. I put it in a directory.
I connect like this:

require_once($_SERVER["DOCUMENT_ROOT"].'/libs/tcpdf/tcpdf.php');
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
$fontname = TCPDF_FONTS::addTTFfont('/libs/tcpdf/fonts/Calibri.ttf', 'TrueTypeUnicode', '', 32);
$pdf->SetFont('Calibri', '', 9);

I am getting an error:
TCPDF ERROR: Could not include font definition file: calibri

Please tell me what am I doing wrong? UTF-8 encoding.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
roswell, 2017-01-10
@Diversia

Just forgot something:

$fontname = TCPDF_FONTS::addTTFfont($_SERVER['DOCUMENT_ROOT'] . '/libs/tcpdf/fonts/Calibri.ttf', 'TrueTypeUnicode', '', 32);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question