samedi 30 septembre 2017

Itext7 Checkbox checking error

I am filling out a premade PDF-Form programatically, using WinForms / C#. Textfields are working as intended, but for a few days now Checkboxes are acting up, though the same code worked before.

I am getting an exception:

"System.NullReferenceException: 'Object reference not set to an instance of an object.'"

Originating from the "toSet.SetValue ..." line of code.

if (radioHVZANein.Checked)
                {
                    fields.TryGetValue("HVZANein", out toSet);
                    toSet.SetValue("Yes");
                }

I checked that the "HVZANein" Checkbox exists, checked that "Yes" is a valid value to set it to. Setting the correct value to the existing field still causes the error (which visual studio helpfully displays on the next line of code, not the one that actually triggers it)

What is going wrong?

Any help is greatly appreciated.




Aucun commentaire:

Enregistrer un commentaire