首页 > 解决方案 > iTextSharp,如何在 pdf 文档中使用我自己的字体

问题描述

当我在 localhost 中运行下面的代码时,没关系,正在使用我的字体创建 pdf 文件,但它在服务器上不起作用。

我将自己的字体放在字体文件夹中并正确上传到服务器。

我的代码部分:

string fontpath = Server.MapPath("~/fonts/");

Font font = FontFactory.GetFont(fontpath + "TTKBDikTemelAbece.ttf", BaseFont.CP1252, BaseFont.EMBEDDED, 14, Font.NORMAL, BaseColor.BLACK );

sb.Append("<font face='"+font.Familyname+"'>");
sb.Append("<table width='100%' align='center' cellspacing='0' cellpadding='8'>");

标签: c#asp.netpdfitext

解决方案


推荐阅读