0

I'm using iTextSharp to write the text in Pdf using Privae font like TradGothic.
My text Contains superScript Also like- ABCCorp®. but it does not appear in Pdf, it appears as Normal Text rounded circle and R inside.

My code is

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();

I'm using PdfStamper to write the text over existing layout.

//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
}

Any help with working sample code will be higly apppriciated.

PS:- i have also tried equivalent HTML and othe code for at the rate R , but nothing works

Justin Iurman
  • 18,954
  • 3
  • 35
  • 54
user3178955
  • 33
  • 1
  • 1
  • 8

1 Answers1

2

Please read the official documentation. Why don't you use ColumnText to add the content? Using BeginText(), SetFontAndSize(), ShowText(), EndText() is for specialists, not for developers who aren't familiar with PDF.

If you use ColumnText, you can use high-level objects, for instance the Chunk object with the SetTextRise() method (see Listing 2.2 in Chapter 2 of my book and also take a look at the C# port of the Java examples).

Bruno Lowagie
  • 75,994
  • 9
  • 109
  • 165
  • I have found the working sample code in CodeProject, i trust them, they have not mentioned that this code i not for developer, is there a way i can use existing code and apply superscript ? – user3178955 Feb 08 '14 at 15:58
  • this post also suggested same thing...Now i want to apply superscript using same way is that possible http://stackoverflow.com/questions/3992617/itextsharp-insert-text-to-an-existing-pdf – user3178955 Feb 08 '14 at 16:06