Q: Can you tell me how to determine if a check box is checked using
FieldFind for FDFDoc and PDFDoc?
FieldFind("FieldName").Current().GetValue().GetStr() generates a
PDFNet exception on this object.
---
A:
Because the value of the checkbox field is a name you need to use
GetName() instead of GetStr().
So instead of FieldFind("FieldName").Current().GetValue().GetStr()
use
FieldIterator itr = doc.FieldFind("FieldName");
if (itr != doc.FieldEnd()) {
Field field = itr.Current();
if (field.GetType() == Field.Type.e_check)
string checkbox_state = field.GetValue().GetName();
// 'Off' means that the checkbox is not checked,
// The recommended (but not required) name for the on state is
'Yes'.
}
}