问题描述
我使用这行代码在 TCPDF
中添加了许多字体
TCPDF_FONTS :: addTTFfont('fonts / ArchitectsDaughter.ttf','TrueTypeUnicode','',96);
$ pdf-> AddFont(ArchitectsDaughter);
许多其他字体正在工作,但是这个不起作用。
当我打开这个pdf到读者,它显示这样的错误
$ b
我正在导入 svg
pdf文件。
这里是文件,我用pdf插入,你可以得到来自的PDF,这里是)
然后,激活字体:
$ b $ writeHTML 函数编写一个unicode字符,从& #x开始,结束于;
例如:为f0c9(酒吧)图标() :
$ pdf-> writeHTML('');
I added many fonts in TCPDF
using this line of code
TCPDF_FONTS::addTTFfont('fonts/ArchitectsDaughter.ttf', 'TrueTypeUnicode', '', 96);
$pdf->AddFont("ArchitectsDaughter");
Many other font is working but, this one is not working.When i opening this pdf into reader, it shows error like this
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.
$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 for me. Don't know what happening with some fonts.What is the solution for this?
First set up the font via TCPDF_FONTS::addTTFfont()
or by adding the necessary files in the fonts dir (convert the TTF file via a TCPDF font converter like http://fonts.snm-portal.com)
After that, activate the font:
$pdf->SetFont('FontAwesome','');
Then, write a unicode character with the writeHTML
function, starting with &#x and ending with ;e.g.: for the f0c9 (bars) icon (http://fontawesome.io/icon/bars/):
$pdf->writeHTML('');
这篇关于TCPDF字体没有加载,显示“...”在Adobe Reader上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!