Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何写上标_C#_Itextsharp - Fatal编程技术网

C# 如何写上标

C# 如何写上标,c#,itextsharp,C#,Itextsharp,我正在使用iTextSharp以Pdf格式编写文本,使用类似TradGothic的Privae字体。 我的文本包含上标,也类似于-ABCCorp®。但它不显示在Pdf中,它显示为普通文本,圆形,内部为R 我的代码是 BaseFont TGothic20CondsdBold = BaseFont.CreateFont(strTGothicBold20Path, BaseFont.CP1252, BaseFont.EMBEDDED); cb.SetFontAndSize(TGothic20Conds

我正在使用iTextSharp以Pdf格式编写文本,使用类似TradGothic的Privae字体。
我的文本包含上标,也类似于-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:-我也尝试过以R的速率使用等效的HTML和其他代码,但没有任何效果

请阅读官方文档。为什么不使用
ColumnText
添加内容?使用
beginext()
SetFontAndSize()
ShowText()
EndText()
是为专家而设,而不是为不熟悉PDF的开发人员而设


如果您使用
ColumnText
,您可以使用高级对象,例如
Chunk
对象和
SetTextRise()
方法(请参见中的清单2.2,并查看一下)。

我在CodeProject中找到了工作示例代码,我相信他们,他们没有提到此代码不是为开发人员编写的,有没有一种方法可以使用现有代码并应用上标?这篇文章也提出了同样的建议…现在我想用同样的方法应用上标,这是可能的吗