当前位置:网站首页>iTextSharp 显示中文字体
iTextSharp 显示中文字体
2022-04-23 01:22:00 【心前阳光】
使用 ttf格式中文字体
函数
public static BaseFont CreateFont(string name, string encoding, bool embedded);
//参数一 字体文件路径
//参数二 编码格式
//参数三 是否嵌入式
例子
BaseFont baseFont2 = BaseFont.CreateFont("./Font/msyh.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
Paragraph chinesePa2 = new Paragraph("中文", new Font(baseFont2, 20f));
document.Add(chinesePa2);
使用 ttc格式中文字体
函数
同样的方法,但参数一不一致;
路径要求:路径+,0 或者 路径+,1
路径实例:./Font/msyh.ttc,0 或 ./Font/msyh.ttc,1
例子
BaseFont baseFont = BaseFont.CreateFont("./Font/msyh.ttc,0", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
Paragraph chinesePa = new Paragraph("中文", new Font(baseFont, 20f));
document.Add(chinesePa);
版权声明
本文为[心前阳光]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_43796392/article/details/124341010
边栏推荐
- Gbase 8s检查点简介
- GBASE 8s分片表管理操作
- Earth day collection: Microsoft and Intel invite you to get the green Ambassador badge and give you negative carbon emission!
- [interview skills] how to face an interview without a leading group
- Introduction to gbase 8s checkpoint
- [HCTF 2018]admin
- On regular expression matching cryptography
- Gbase 8s shared memory segment deletion
- 留给给5月的文章
- 【Android工程师与智能家居产品的第一次接触③】SmartConfig一键配网在硬件端的具体实现|ESP8266一键配网在Arduino的具体实现|玉念聿辉
猜你喜欢

Pilotage growth · ingenuity empowerment -- yonmaster developer training and pilotage plan is fully launched

Cai Guoqiang's fireworks NFT debut is as wonderful as fireworks during the day

Hardware IIC analysis and configuration process of imx6ull bare metal development

Innovative practice of short video content understanding and generation technology in meituan

Basic knowledge of software testing (detailed version) collection of this article is enough

API IX JWT auth plug-in has an error. Risk announcement of information disclosure in response (cve-2022-29266)

【Android工程师与智能家居产品的第一次接触③】SmartConfig一键配网在硬件端的具体实现|ESP8266一键配网在Arduino的具体实现|玉念聿辉

200. Number of islands

Let's talk about ruby

gin--hello
随机推荐
Common problems and solutions of crashsight access reporting
Three technical solutions of ant group were selected as "typical solutions for information technology application and innovation in 2021"
gin--hello
Text justify, orientation, combine text attributes
Is it difficult for girls to learn software testing?
Vs + C realizes that the form input box displays gray text by default
Thingskit Internet of things platform
Activity preview | on April 23, a number of wonderful openmldb sharing came, which lived up to the good time of the weekend!
天梯赛L2-6 树的遍历
Five commonly used order receiving platforms recommended by programmers
全排列(DFS和next_permutation解法)
From thinking to practice, digital transformation is the successful path of it operation
修改数组(并查集)
engine. Post() handles post requests
[actf2020 freshman competition]
DFS奇偶性剪枝
Initial experience of talent plan learning camp: communication + adhering to the only way to learn open source collaborative courses
Get in the car, the era of intelligent database autonomy has come, and Tencent cloud database x AI has made a new breakthrough
Good test data management, in the end how to do?
Application of safe electricity management platform in Jingbian Museum safe electricity management system