首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >iTextSharp如何编写SuperScript

iTextSharp如何编写SuperScript
EN

Stack Overflow用户
提问于 2014-02-08 20:33:45
回答 1查看 1.6K关注 0票数 0

我用iTextSharp写的文本在Pdf中使用像TradGothic这样的私人字体。

我的文本包含superScript,也像- ABCCorp®。但它不会出现在Pdf中,它显示为正常的文本圆圈和R内。

我的代码是

代码语言:javascript
运行
复制
BaseFont TGothic20CondsdBold = BaseFont.CreateFont(strTGothicBold20Path, BaseFont.CP1252, BaseFont.EMBEDDED);
cb.SetFontAndSize(TGothic20CondsdBold, 15);
cb.SetLeading(12.5f);
cb.MoveText(187, 185);
cb.ShowText("ABCCorp®");
cb.EndText();

我正在使用PdfStamper在现有布局上编写文本。

代码语言:javascript
运行
复制
//Use a PdfStamper to bind our source file with our output file
using (PdfStamper stamper = new PdfStamper(reader, fs))
{
   //In case of conflict we want our new text to be written "on top" of any existing content
   //Get the "Over" state for page 1
   PdfContentByte cb = stamper.GetOverContent(1);

   cb.BeginText();
   //Set the font information for heading
}

任何对工作样例代码的帮助都将得到高度评价。

PS:-我也尝试了相同的HTML和其他代码,但都不起作用

EN

回答 1

Stack Overflow用户

发布于 2014-02-08 21:00:18

请阅读官方文档。为什么不使用ColumnText来添加内容呢?使用BeginText()SetFontAndSize()ShowText()EndText()是专为专业人士准备的,不适合不熟悉EndText()的开发人员。

如果使用ColumnText,则可以使用高级对象,例如带有SetTextRise()方法的Chunk对象(请参阅Chapter 2 of my book中的清单2.2,还可以查看the C# port of the Java examples)。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21646011

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档