I'm getting a system.NullReferenceException when I'm assigning a text value to a PDF form that I created in Acrobat Pro DC. The stack trace indicates it's happening deep in the PdfSharp.Pdf.AcroForms.PdfTextField.RenderAppearance() code. Here's the stack trace:
at PdfSharp.Pdf.AcroForms.PdfTextField.RenderAppearance() at PdfSharp.Pdf.AcroForms.PdfTextField.set_Text(String value) at <my code that assigns the text value>
This line is causing the exception: ((PdfTextField)field).Text = origValue;
I'm new to PdfSharp, so I'm guessing I must have missed something basic.
Can anyone lend some insight? What do I need to do to stop throwing this exception?
Oh, by the way, I get the same error when I run the sample code for filling out form fields.
If I wrap the assignments in a try/catch block and ignore the exceptions, the form is filled out correctly. I can open it in Adobe Acrobat and see all the data so it seems like a bug in PdfSharp.
Thanks in advance, Ken
|