I\'m working on dynamically filling in the fields on a pdf document using ITextSharp. I\'d like to be able to determine the \"export value\" of the checkbox is from the cod
I couldn't get the answer Mark to work for me because the appearanceDict was always null. Here is a method I wrote that works for the CheckBox and RadioButton controls on the forms I'm dealing with.
private static string GetAnswerValue(AcroFields.Item f, int i)
{
var widg = f.GetWidget(i);
if (widg == null)
return null;
var ap = widg.GetAsDict(PdfName.AP);
if (ap == null)
return null;
//PdfName.D also seems to work
var d = ap.GetAsDict(PdfName.N);
if (d == null)
return null;
var e = d.Keys.FirstOrDefault(n => !n.Equals(PdfName.OFF));
if (e == null)
return null;
return e.ToString().Substring(1);
}