c# - 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'>");
解决方案
推荐阅读
- spring-boot - 在客户端应用程序中设置和更新 Keycloak/OpenId-Connect 声明
- pytorch - 了解 TensorboardX 图
- c++ - 从 Boost 1.73+ Asio 中的套接字获取 io_context 引用
- r - 将变量中的数字与字符分开,长度不一致 -R
- r - R:Quantmod 在股票代码前用 ^ 符号拉动标准普尔指数
- elasticsearch - Searchkick / Elasticsearch 聚合的结果不一致
- javascript - 将字符串中的所有指定整数返回到数组中
- r - 预测 svm 模型
- debian - 构建一个没有 tarball 的 Debian 软件包
- flutter - Flutter 更改验证错误消息位置