我用iTextSharp写的文本在Pdf中使用像TradGothic这样的私人字体。
我的文本包含superScript,也像- ABCCorp®。但它不会出现在Pdf中,它显示为正常的文本圆圈和R内。
我的代码是
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在现有布局上编写文本。
//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和其他代码,但都不起作用
发布于 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)。
https://stackoverflow.com/questions/21646011
复制相似问题