iTextSharp的(iText的) - 设置段自定义字体 [英] ItextSharp (Itext) - set custom font for paragraph

查看:1972
本文介绍了iTextSharp的(iText的) - 设置段自定义字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自定义字体设置为段落,但我不能使它工作。
我尝试设置.Font =,但它仅适用大小明智的,但它忽略字体。 ?能否请您协助

 第T =新段(newTempLine); 
iTextSharp.text.Font contentFont = iTextSharp.text.FontFactory.GetFont(Webdings,12,iTextSharp.text.Font.NORMAL);
T.Font = contentFont;
myDocument.Add(T);


解决方案

设置它的the构造

 字体contentFont = FontFactory.GetFont(...); 
段段=新段(newTempLine,contentFont);


I am trying to set custom font to Paragraph, but I can't make it work. I tried setting .Font= , but it only works size-wise, but it ignores font. Could you please assist?

Paragraph T = new Paragraph(newTempLine);
iTextSharp.text.Font contentFont = iTextSharp.text.FontFactory.GetFont("Webdings", 12, iTextSharp.text.Font.NORMAL);
T.Font = contentFont;
myDocument.Add(T);

解决方案

Set it in the constructor:

Font contentFont = FontFactory.GetFont(…);
Paragraph para = new Paragraph(newTempLine, contentFont);

这篇关于iTextSharp的(iText的) - 设置段自定义字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆