Com.Radaee.Pdf.Document document = new Com.Radaee.Pdf.Document(); document.OpenStream(memStream, null); if (document.OpenStream(memStream, "") == 0) { for (int i = 0; i < document.PageCount; i++) { Com.Radaee.Pdf.Page page = document.GetPage(i); page.ObjsStart(); for (int j = 0; j < page.AnnotCount; j++) { Com.Radaee.Pdf.Page.Annotation annot = page.GetAnnot(j); if (annot.CheckStatus >= 0) { //checkbox/radio form int checkstatus = annot.CheckStatus; if ((checkstatus == 2) || (checkstatus == 3)) //E' un radiobox { string fieldName = annot.FieldName; if (annot.ReadOnly) continue; string fieldCurrentValue = Convert.ToString(checkstatus); if (oldAcrofieldsValues == null) { // MODALITA SCORRIMENTO PDF if (!acrofields.ContainsKey(fieldName)) // solo 1 volta { acrofields.Add(fieldName, fieldCurrentValue); annot.SetRadio(); Log.Debug("getAcroFieldsStatus", string.Format("Type = e_radio - Field name: {0} value: '{1}'.", fieldName, fieldCurrentValue)); document.Save(); } } else { // MODALITA RECUPERO MODIFICHE if (oldAcrofieldsValues.ContainsKey(fieldName)) { if (!acrofields.ContainsKey(fieldName)) // solo 1 volta { // se il valore è uguale a quello di prima non faccio nulla if (oldAcrofieldsValues[fieldName].ToString() == fieldCurrentValue) continue; acrofields.Add(fieldName, fieldCurrentValue); annot.SetRadio(); document.Save(); Log.Debug("getAcroFieldsStatus", string.Format("Type = e_radio - Field name: {0} value: '{1}'.", fieldName, fieldCurrentValue)); } } } }//Radio if ((checkstatus == 0) || (checkstatus == 1)) //E' un checkbox { string fieldName = annot.FieldName; if (annot.ReadOnly) continue; string fieldCurrentValue = Convert.ToString(checkstatus); if (oldAcrofieldsValues == null) { // MODALITA SCORRIMENTO PDF if (acrofields.ContainsKey(fieldName)) acrofields[fieldName] = fieldCurrentValue; else acrofields.Add(fieldName, fieldCurrentValue); annot.SetCheckValue(Convert.ToBoolean(checkstatus)); document.Save(); Log.Debug("getAcroFieldsStatus", string.Format("Type = e_check - Field name: {0} value: '{1}'.", fieldName, fieldCurrentValue, fieldCurrentValue, annot.Name)); } else { // MODALITA RECUPERO MODIFICHE if (oldAcrofieldsValues.ContainsKey(fieldName)) { if (Convert.ToString(oldAcrofieldsValues[fieldName]) == Convert.ToString(fieldCurrentValue)) continue; if (acrofields.ContainsKey(fieldName)) acrofields[fieldName] = fieldCurrentValue; else acrofields.Add(fieldName, fieldCurrentValue); annot.SetCheckValue(Convert.ToBoolean(fieldCurrentValue)); document.Save(); Log.Debug("getAcroFieldsStatus", string.Format("Type = e_check - Field name: {0} old value: '{1}' new value: '{2}'.", fieldName, oldAcrofieldsValues[fieldName], fieldCurrentValue)); } } } } if (annot.EditType > 0) { string fieldName = annot.FieldName; string fieldCurrentValue = null; if (annot.EditText != null) fieldCurrentValue = annot.EditText; if (oldAcrofieldsValues == null) { // MODALITA SCORRIMENTO PDF if (acrofields.ContainsKey(fieldName)) acrofields[fieldName] = fieldCurrentValue; else acrofields.Add(fieldName, fieldCurrentValue); annot.SetEditText(fieldCurrentValue); document.Save(); Log.Debug("getAcroFieldsStatus", string.Format("Type = e_text - Field name: {0} value: '{1}'.", fieldName, fieldCurrentValue)); } else { // MODALITA RECUPERO MODIFICHE if (oldAcrofieldsValues.ContainsKey(fieldName)) { // il "nuovo" valore è null o è stato specificato? if (string.IsNullOrEmpty(fieldCurrentValue)) { // no: nuovo valore è "null" // se quello di prima era "null" allora passo al prossimo if (oldAcrofieldsValues[fieldName] == null) continue; } else { // si: il nuovo valore è stato specificato // se il vecchio valore era diverso da "null" e uguale al nuovo allora passo al prossimo if (oldAcrofieldsValues[fieldName] != null && oldAcrofieldsValues[fieldName].ToString() == fieldCurrentValue) continue; } if (acrofields.ContainsKey(fieldName)) acrofields[fieldName] = fieldCurrentValue; else acrofields.Add(fieldName, fieldCurrentValue); annot.SetEditText(fieldCurrentValue); document.Save(); Log.Debug("getAcroFieldsStatus", string.Format("Type = e_text - Field name: {0} old value: '{1}' new value: '{2}'.", fieldName, oldAcrofieldsValues[fieldName], fieldCurrentValue)); } } } } page.Close(); } } document.Save(); document.Close(); Session.PreSignPDF = memStream.Get_data();