I need to fill an xfa form using acrobat.
I have used the following code:
Type AcrobatCAcroAppType = Type.GetTypeFromProgID("AcroExch.AVDoc");
Type AcrobatPDDocType = Type.GetTypeFromProgID("AcroExch.PDDoc");
if ((AcrobatCAcroAppType == null) || (AcrobatPDDocType == null))
throw new Exception("Acrobat not installed on this system.");

CAcroAVDoc avDoc = (Acrobat.CAcroAVDoc)Activator.CreateInstance(Acrob atCAcroAppType);
CAcroPDDoc pdDoc = (Acrobat.CAcroPDDoc)Activator.CreateInstance(Acrob atPDDocType);

// Open the pdf
if (!avDoc.Open(fileName, ""))
{
string szMsg = "Cannot open" + fileName + ".";
throw new Exception(szMsg);

}
pdDoc.Open(fileName);
dynamic jsObj = pdDoc.GetJSObject();
jsObj.getXMLData();

But jsObj.getXMLData(); throws an exception "Value does not fall within the expected range."

System.ArgumentException: Value does not fall within the expected range.
at System.Runtime.InteropServices.Marshal.ThrowExcept ionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExcept ionForHR(Int32 errorCode)
at System.Dynamic.ComRuntimeHelpers.CheckIfMissingTyp eInfoIsExpected(Int32 hresult, Boolean throwIfMissingExpectedTypeInfo)
at System.Dynamic.ComRuntimeHelpers.GetITypeInfoFromI Dispatch(IDispatch dispatch, Boolean throwIfMissingExpectedTypeInfo)
at System.Dynamic.IDispatchComObject.EnsureScanDefine dMethods()
at System.Dynamic.IDispatchComObject.System.Dynamic.I DynamicMetaObjectProvider.GetMetaObject(Expression parameter)
at System.Dynamic.DynamicMetaObject.Create(Object value, Expression expression)
at System.Dynamic.DynamicMetaObjectBinder.Bind(Object[] args, ReadOnlyCollection`1 parameters, LabelTarget returnLabel)
at System.Runtime.CompilerServices.CallSiteBinder.Bin dCore[T](CallSite`1 site, Object[] args)
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at CallSite.Target(Closure , CallSite , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoi d1[T0](CallSite site, T0 arg0)


Please let me know what I am missing out. I am very new to xfa forms.