是否可以在fpdf中嵌入fontawesome字体? [英] Is possible to embed fontawesome font in fpdf?

查看:91
本文介绍了是否可以在fpdf中嵌入fontawesome字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在pdf中使用fontawesome.我使用php库fpdf和字体嵌入生成了pdf.但是我无法使其正常工作.

I'd like to use fontawesome in pdf. I generate my pdf using php library fpdf and font embedding. However I cannot make it works.

我使用此工具生成afm文件: http://fpdf.fruit-lab.de/

I use this tool to generate afm file: http://fpdf.fruit-lab.de/

但是当我尝试使用fontawesome时,我总是得到白色正方形而不是图标.

But when I try to use fontawesome I always get white square instead of icons.

我使用以下语法添加图标:

I use this syntax to add icon:

MultiCell(0,8,"\uF000 ",0,'C')

推荐答案

由于我从未使用过fpdf,因此无法回答.但是,我确实使用 mPDF ,而且我经常使用fontawesome -完全没有问题.我唯一要确保的是,我输出到PDF文档的内容(mPDF是以HTML标记的形式)必须是UTF8编码的.

I cannot answer for fpdf since I have never used it. However, I do use mPDF and there I use fontawesome regularly - no issues at all. The only thing I have to ensure is that the content I output to the PDF document (mPDF takes this in the form of HTML markup) hast to be UTF8 encoded.

mPDF非常好,因此,如果您处于项目的早期阶段,则可以考虑切换到它.否则,值得探讨您是否也没有遇到UTF8编码问题.

mPDF is very good so if you are at an early stage of your project you might just consider switching to it. Otherwise, it is worth exploring whether you too are not running into a UTF8 encoding issue.

这篇关于是否可以在fpdf中嵌入fontawesome字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆