Question

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!

Was it helpful?

Solution 2

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top