tags:

views:

198

answers:

2

I am using iTextSharp to fill pre-defined fields on an existing PDF document using the folowing syntax:

PdfStamper stamper = new PdfStamper(reader, stream);
stamper.AcroFields.SetField("A","O'Henry");
stamper.FormFlattening = true;
stamper.Close();

Unfortunately, apostrophes (and likely other forms of common punctuation) are not displayed in the output PDF. For instance, in the code above, field "A" displays the text "OHENRY" instead of "O'HENRY".

How do I get the output PDF to display the text including the apostrophes?

Also, please note that I do not have control over creating/modifying the original PDF being filled. I was given the PDF from an external source and will likely be given new versions of the PDF as the form changes.

Thanks!

+1  A: 

An easy fix is to replace the single quotes with the ` character.

Chris Ballance
Although not the ideal solution, I tried this to no avail - the ` character was removed in the same manner as the apostrophe.
A: 

I found a solution here http://www.nabble.com/Populating-form-fields-with-Unicode-data-td21610346.html.

This solution involves embedding into each field a font that can handle the desired characters.