TCPDF添加新字体

将字体复制到TCPDF\tools 目录下

打开CMD窗口定位到TCPDF\tools 目录 执行下面的命令

我们以微软雅黑字体为例

 php ./tcpdf_addfont.php -b -t TrueTypeUnicode -f 97 -i msyh.ttf

如果成功CMD会出现下面的代码

>>> Converting fonts for TCPDF:
*** Output dir set to C:\phpStudy\PHPTutorial\WWW\chuanqi\vendor\tcpdf/fonts/
+++ OK   : C:\phpStudy\PHPTutorial\WWW\chuanqi\vendor\tcpdf\tools\msyh.ttf added
 as msyh
>>> Process successfully completed!

这时微软雅黑字体就转换完成并复制到TCPDF\fonts目录下了

直接设置字体即可

 $pdf->SetFont('msyh', '', 10, '', true);

如果php不是内部命令

请将php目录加入环境遍量

具体方法请咨询度娘

提示:微软雅黑如果商用请购买授权!!!!!!!

猜你喜欢

转载自www.cnblogs.com/binxl/p/12337897.html
今日推荐