C# ItextSharp Fontawesome Icons ( currency ) - PDF

狂风中的少年 提交于 2019-12-10 21:08:37

问题


i have problem is importing the icons (fontawesome-webfont.ttf) and showing them on PDF -but i am unable to show them on the PDF especialy currency icon (fa-money) some of the icons i was able to get it from the CultureInfo class if any thing i missed apart from this

chunkRows = new Chunk(val.ToString("C", new CultureInfo(strCulture)) + "  ", rowFont);

How can i solve this problem needed help

Code---

var fontAwesomeIcon = BaseFont.CreateFont(fontpath + "fontawesome-webfont.ttf", BaseFont.CP1252, BaseFont.EMBEDDED);

Font fontAwe = new Font(fontAwesomeIcon,8,Font.NORMAL,Color.BLACK);

chunkRows = new Chunk("\f0d6", fontAwe);

回答1:


Please adapt your code like this:

var fontAwesomeIcon = BaseFont.CreateFont(fontpath + "fontawesome-webfont.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Font fontAwe = new Font(fontAwesomeIcon, 8);
chunkRows = new Chunk("\uf0d6", fontAwe);

The result will look like this:



来源:https://stackoverflow.com/questions/30440982/c-sharp-itextsharp-fontawesome-icons-currency-pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!