I added a lot of fonts to TCPDF using this line of code
TCPDF_FONTS::addTTFfont('fonts/ArchitectsDaughter.ttf', 'TrueTypeUnicode', '', 96); $pdf->AddFont("ArchitectsDaughter");
Many other fonts work, but this one does not work. When I open this PDF file in the reader, it shows an error similar to this
cannot extract the built-in font "ArchitectsDaughter". some character may not be displayed or printed correctly.
I am importing a svg file in pdf format. Here is the SVG file that I insert in pdf and you can get the PDF from here and here is the font file .
Here is the complete code that pdf will generate.
$fileName='export'; $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->AddFont("Archivor"); $pdf->AddFont("ArchitectsDaughter"); $pdf->SetPrintHeader(false); $pdf->SetPrintFooter(false); $pdf->AddPage(); $pdf->ImageSVG($uploadPath, $x='', $y='', $w='', $h='', $link='', $align='', $palign='', $border=0, $fitonpage=true); $filename = 'export.pdf'; $pdf->output($filename, 'D'); exit;
Other fonts work fine for me. I donβt know what happens with some fonts. What is the solution for this?
source share