Here\'s the situation. I have a PDF with automatically generated pdf form field names. The problem is that these names are not very user friendly. They look something like :
The good news: you can change field names in iTextSharp.
You can't actually edit a PDF though. You'd read in an existing PDF, update your field names in memory and then write out your revised PDF. To change a field name call the AcroFields.RenameField method.
Here's a snippet:
PdfReader reader = new PdfReader(PDF_PATH);
using (FileStream fs = new FileStream("Test Out.pdf", FileMode.Create)) {
PdfStamper stamper = new PdfStamper(reader, fs);
AcroFields fields = stamper.AcroFields;
fields.RenameField("oldFieldName", "newFieldName");
stamper.Close();
}
Now the bad news: there appear to be limitations in the characters you can use in the renamed fields.
I tested the snippet above with your example field name and it didn't work. Remove the periods though and it does work. I'm not sure if there's a workaround but this may be a problem for you,