Tuesday, 10 September 2013

Cannot output pound symbol to PDF

Cannot output pound symbol to PDF

I've been trying to open and edit a PDF file using itextsharp.
Everything works absolutely fine however for some reason I cannot write a
'£' to the PDF.
When output does generate though, it leaves 'blank space', this has left
me puzzled.
Wondering if anyone has come across this before?
This is my code:
PdfContentByte cb = stamper.GetOverContent(x);
iTextSharp.text.Rectangle rectangle = new iTextSharp.text.Rectangle(370,
750, 155, 790);
rectangle.BackgroundColor = new BaseColor(Color.FromArgb(147, 146, 152));
cb.Rectangle(rectangle);
BaseFont baseFont = BaseFont.CreateFont(BaseFont.HELVETICA,
BaseFont.CP1250, BaseFont.NOT_EMBEDDED);
cb.SetColorFill(BaseColor.WHITE);
cb.SetFontAndSize(baseFont, 21);
cb.BeginText();
var encoder = System.Text.Encoding.GetEncoding(858); //also tried with 437
byte[] c = new byte[] { 156 };
string appendto = "£" + textBox1.Text;
cb.ShowTextAligned(PdfContentByte.ALIGN_CENTER, appendto, 245, 764, 0);
cb.EndText();

No comments:

Post a Comment