Home Ask Login Register

Developers Planet

Your answer is one click away!

Himanshu Bhardiya February 2016

TCPDF font not embadding, showing "..." on adobe reader

I added many fonts in TCPDF using this line of code

TCPDF_FONTS::addTTFfont('fonts/ArchitectsDaughter.ttf', 'TrueTypeUnicode', '', 96);

Many other font is working but, this one is not working. When i opening this pdf into reader, it shows error like this

cannot extract the embedded font 'ArchitectsDaughter'. some character may not display or print correctly.

I am importing svg file in pdf. Here is the SVG file which i inserting in pdf, and you can get PDF from here and here is the font file.

Here is full code how pdf will generates.

$uploadPath = Config::get('constants.paths.uploads.images.base').'/'.$fileName.'.svg';

$pdf = new TCPDF();

TCPDF_FONTS::addTTFfont(dirname(dirname(dirname(dirname(__FILE__)))).'/vendor/font-awesome/fonts/ArchitectsDaughter.ttf', 'TrueTypeUnicode', '', 96);
TCPDF_FONTS::addTTFfont(dirname(dirname(dirname(dirname(__FILE__)))).'/vendor/font-awesome/fonts/Archivor.ttf', 'TrueTypeUnicode', '', 96);


$pdf->ImageSVG($uploadPath, $x='', $y='', $w='', $h='', $link='', $align='', $palign='', $border=0, $fitonpage=true);
$filename = 'export.pdf';
$pdf->output($filename, 'D');

Other fonts working ok for me. Don't know what happening with some fonts. What is the solution for this?


Gennadiy Litvinyuk February 2016

According to documentation TCPDF_FONTS::addTTFfont() adds the provided font permanently to the fonts folder and returns its name. So there is no reason to add it every time, but it is necessary to use added font with correct name.

// ...

$pdf = new TCPDF();

$fontArchitectsDaughter = TCPDF_FONTS::addTTFfont(realpath(__DIR__ . '/../../../vendor/font-awesome/fonts/ArchitectsDaughter.ttf'), 'TrueTypeUnicode', '', 96);
$fontArchivor = TCPDF_FONTS::addTTFfont(realpath(__DIR__ . '/../../../vendor/font-awesome/fonts/Archivor.ttf'), 'TrueTypeUnicode', '', 96);


// ...

Post Status

Asked in February 2016
Viewed 2,910 times
Voted 11
Answered 1 times


Leave an answer

Quote of the day: live life