We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert Dynamic XFA Form to Standard AcroForm using Aspose.PDF for .NET - Error during conversion

We have been using Aspose.pdf with AcroForms for quite some time and have built up libraries to process pdfs. Our organization has recently bought Adobe LiveCycle Designer ES4 and our form development has switched to LiveCycle which produces XFA forms instead of AcroForms.



I need to be able to work with these forms with Aspose for several applications both in production and in development.



I tried to convert the first form produced with LiveCycle using the suggested code in the documentation located here http://www.aspose.com/docs/display/pdfnet/Convert+Dynamic+XFA+Form+to+Standard+AcroForm



Unfortunately I’m encountering the error “The type initializer for ‘Aspose.Rendering.Aspose.Foundation5484965.ApsTextField’ threw an exception.” when trying to convert an XFA form to a Standard form.



This is a critical application for our organization and I have an approaching deadline to find a solution for this.



Please help!



Thanks.



The XFA form pdf file is attached.



I’m using .net 4.0 framework within Visual Studio 2013.



The version of Aspose.pdf is 11.3.0.0 (2016.02.07)



The code to produce the error is:

Aspose.Pdf.License license = new Aspose.Pdf.License();

license.SetLicense(“Aspose.Total.lic”);

Aspose.Pdf.Document doc = new Aspose.Pdf.Document(@“c:\XfaForm.pdf”);

doc.Form.Type = FormType.Standard;

doc.Save(@“c:\AcroForm.pdf”);



The error occurs on the the line doc.Form.Type = FormType.Standard



The full stack trace is below.



[IOException: No more data is available.

]

Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str) +3426297

Microsoft.Win32.RegistryKey.GetValueNames() +10765165

..Ž(IDictionary ) +207

•..() +630

•..() +149

•..(String , FontStyle ) +42

•..‡(String , FontStyle , String ) +65

•..ˆ(String , Single , FontStyle , String ) +63

•..ˆ(String , Single , FontStyle ) +50

Aspose.Rendering.Aspose.Foundation5484965.ApsTextField…cctor() +80



[TypeInitializationException: The type initializer for ‘Aspose.Rendering.Aspose.Foundation5484965.ApsTextField’ threw an exception.]

Aspose.Rendering.Aspose.Foundation5484965.ApsTextField…ctor(PointF , String , SizeF , Boolean ) +0

ž..š(e , XmlNode ) +248

ž..š(e , XmlNode , ) +536

ž..š(e , XmlNode ) +109

ž.•.š(e , XmlNode ) +731

ž.‹.š(e , XmlNode ) +62

ž.•.š(e , XmlNode ) +731

ž.•.š(e , XmlNode ) +731

ž.•.š(e , XmlNode ) +731

ž.•.š(e , XmlNode ) +731

ž..ˆž(XmlDocument , XmlDocument , XmlDocument , SizeF , ˆ , e‰ž ) +843

ž.ž.Convert(Dictionary2 , €‰ž ) +708 <br /> Aspose.Pdf.InteractiveFeatures.Forms.Form.•aŸ(String , String , String ) +2237 <br /> Aspose.Pdf.InteractiveFeatures.Forms.Form.set_Type(FormType value) +167 <br /> eApprovalAdmin.Business.AdminBL.convertFormToStandard() in c:\TFSProjects\HFS-EDI-eApproval\Main\Source\eApproval\eApprovalAdmin\Business\AdminBL.cs:261 <br /> eApprovalAdmin.Controllers.AdminController.Create() in c:\TFSProjects\HFS-EDI-eApproval\Main\Source\eApproval\eApprovalAdmin\Controllers\AdminController.cs:31 <br /> lambda_method(Closure , ControllerBase , Object[] ) +102 <br /> System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +59 <br /> System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +435

System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +60 <br /> System.Web.Mvc.Async.ActionInvocation.InvokeSynchronousActionMethod() +76 <br /> System.Web.Mvc.Async.AsyncControllerActionInvoker.b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +36 <br /> System.Web.Mvc.Async.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult) +73

System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +136 <br /> System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102 <br /> System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +49 <br /> System.Web.Mvc.Async.AsyncInvocationWithFilters.b__3d() +117 <br /> System.Web.Mvc.Async.<>c__DisplayClass46.b__3f() +323 <br /> System.Web.Mvc.Async.<>c__DisplayClass33.b__32(IAsyncResult asyncResult) +44 <br /> System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +47

System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +136 <br /> System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102 <br /> System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50 <br /> System.Web.Mvc.Async.<>c__DisplayClass2b.b__1c() +72 <br /> System.Web.Mvc.Async.<>c__DisplayClass21.b__1e(IAsyncResult asyncResult) +185 <br /> System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +42

System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +133 <br /> System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56 <br /> System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40 <br /> System.Web.Mvc.Controller.b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +34 <br /> System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +70

System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +139 <br /> System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59 <br /> System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40 <br /> System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44 <br /> System.Web.Mvc.Controller.b__15(IAsyncResult asyncResult, Controller controller) +39 <br /> System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +62

System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +139 <br /> System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59 <br /> System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40 <br /> System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39 <br /> System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39 <br /> System.Web.Mvc.MvcHandler.b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +39 <br /> System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +70

System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139

System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59

System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40

System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40

System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38

System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9658236

System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Hi Paul,


Thanks for contacting support.

I have tested the scenario using Aspose.Pdf for .NET 11.6.0 in Visual Studio 2015 project running over Windows 10 and I am unable to notice any issue. As per my observations, the resultant file is properly being generated. For your reference, I have also attached the output generated over my end.

Can you please try using the latest release and in case you still face the same problem, please share some further details regarding your working environment. We are sorry for this inconvenience.

[C#]

Aspose.Pdf.Document doc = new Aspose.Pdf.Document(@“c:/pdftest/XfaForm.pdf”);<o:p></o:p>

doc.Form.Type = Aspose.Pdf.Forms.FormType.Standard;

doc.Save(@"c:/pdftest/Standard_AcroForm.pdf");

Thank you Mr. Shahbaz. I’m running Windows 7 and Visual Studio 2013, so that may be the issue.

I found that the file did not convert as well as I had hoped.

Are there any plans for Aspose.Pdf to support XFA forms developed with Adobe LiveCycle?

Thanks,
Paul

Hi Paul,


Thanks for sharing the details.

It appears that you are getting problem while using older release (11.3.0) and I did not notice any problem while using latest release of Aspose.Pdf for .NET 11.6.0. Can you please try using latest release and in case you still face any issue or you have any further query, please feel free to contact.