当前位置:网站首页>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
边栏推荐
- Yyds dry goods counting flag variable rule
- [HCTF 2018]admin
- Fault analysis | federated storage engine table causes the monitoring thread to be in the opening table state
- VRF in Mina
- Let's talk about ruby
- Im instant messaging development how to design a database that can support millions of concurrent users
- Processus d'analyse et de configuration du matériel IIC pour le développement de la machine nue imx6ull
- Gbase 8s存储结构简介及空间管理
- Articles for May
- What is the legal basis and procedure for Tami dog sharing | state owned equity transfer?
猜你喜欢

Small example of gin - get request 1-handle handles get requests

全排列(DFS和next_permutation解法)

On regular expression matching cryptography

计蒜客:方程的解数

VS+C# 实现窗体输入框默认显示灰色文字

王子救公主(DFS)

engine.POST()处理POST请求

2022 penetration job interview (thinking)

JD side: how can a child thread get the value of the parent thread ThreadLocal? I got...

Tdengine deployment cluster installation
随机推荐
蒜头君开公司(DFS全排列)
IMX6ULL裸机开发之硬件SPI分析及配置过程
Generating class diagram with EA reverse engineering code
Gbase 8s数据库日志简介及管理
Design and application of intelligent lighting control system in hospital
Use Charles to grab app package
What is October 24th? Why are there no senior programmers in China in their fifties and sixties, while foreigners,,, Yu Nianyu Hui take you to celebrate the 1024 programmer Festival
Gbase 8s 共享内存段删除
Is it difficult for girls to learn software testing?
Rotation slice
Gbase 8s fragment table management operation
engine.POST()处理POST请求
京東一面:子線程如何獲取父線程 ThreadLocal 的值?我蒙了。。。
Basic operation of Android local database | multi thread operation database | addition, deletion, modification and query of database | batch insertion into database | basic use of thread pool | Yu nia
Chapter 9 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of exercises for users to establish their own data types
The complete form of smart home and the development of "small homekit"
Pilotage growth · ingenuity empowerment -- yonmaster developer training and pilotage plan is fully launched
Thingskit Internet of things platform
engine. Post() handles post requests
GBase 8s查询处理和优化