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


i added many fonts in tcpdf using line of code

tcpdf_fonts::addttffont('fonts/architectsdaughter.ttf', 'truetypeunicode', '', 96); $pdf->addfont("architectsdaughter"); 

many other font working but, 1 not working. when opening pdf reader, shows error this

cannot extract embedded font 'architectsdaughter'. character may not display or print correctly.

i importing svg file in pdf. here svg file inserting in pdf, , can pdf here , here font file.

here full code how pdf generates.

$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 working ok me. don't know happening fonts. solution this?

according documentation tcpdf_fonts::addttffont() adds provided font permanently fonts folder , returns name. there no reason add every time, necessary use added font 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);  $pdf->addfont($fontarchivor); $pdf->addfont($fontarchitectsdaughter);  // ... 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -