public String[] GetAppearanceStates(String fieldName) {
Item fd = (Item)fields[fieldName];
if (fd == null)
return null;
Hashtable names = new Hashtable();
PdfDictionary vals = fd.GetValue(0);
PdfString stringOpt = vals.GetAsString( PdfName.OPT );
if (stringOpt != null) {
names[stringOpt.ToUnicodeString()] = null;
}
else {
PdfArray arrayOpt = vals.GetAsArray(PdfName.OPT);
if (arrayOpt != null) {
for (int k = 0; k < arrayOpt.Size; ++k) {
PdfString valStr = arrayOpt.GetAsString( k );
if (valStr != null)
names[valStr.ToUnicodeString()] = null;
}
}
}
for (int k = 0; k < fd.Size; ++k) {
PdfDictionary dic = fd.GetWidget( k );
dic = dic.GetAsDict(PdfName.AP);
if (dic == null)
continue;
dic = dic.GetAsDict(PdfName.N);
if (dic == null)
continue;
foreach (PdfName pname in dic.Keys) {
String name = PdfName.DecodeName(pname.ToString());
names[name] = null;
}
}
string[] outs = new string[names.Count];
names.Keys.CopyTo(outs, 0);
return outs;
}