How to export an InfoPath form in PDF format from the built-in WinForm FormControl?

I have a C # WinForm application that (among other things) hosts an InfoPath FormControl to allow users to fill out some forms. The save method provided by WinForm, in addition to saving the XML form, also exports the form in PDF format so that a copy of the PDF can be sent by e-mail.

Everything worked fine when we used InfoPath 2007. Since the company is now updating all machines using Office, from 2007 to 2010 I need to update the application for working with InfoPath 2010. After changing the necessary links, everything seemed to work fine while the save function Did not try to export the form to PDF. The following is the code to export the form (which worked previously when using 2007):

this.view.OutputForm.XmlForm.CurrentView.Export(pdfFile, Microsoft.Office.InfoPath.ExportFormat.Pdf); 

OutputForm - Microsoft.Office.InfoPath.FormControl object. When the Export method is called, this exception is thrown:

InfoPath has encountered an error. failed to complete the operation.

InfoPath cannot export the form. no supported interface

at Microsoft.Office.Interop.InfoPath.SemiTrust.View.Export (String bstrURL, String strFormat)

at Microsoft.Office.Interop.InfoPath.SemiTrust.ViewObjectWrapper.Export (String bstrURL, String bstrFormat)

at Microsoft.Office.InfoPath.Internal.ViewHost.Export (String fileLocation, ExportFormat format) ...

I can’t imagine that this functionality has just been torn from the hosted InfoPath 2010 FormControl, right? I really hope this is not the case.

Are there InfoPath wizards here that can point me in the right direction (what am I missing or an alternative solution)?

Based on the materials of Arthur Mustafin, I am open to listening to alternative solutions for creating PDF from the InfoPath form.

A note for anyone who came across this found this thread on social.msdn.microsoft.com , where Bruce Song states that:

... this is a known issue from Microsoft's internal error checking system and the product group is trying to fix it.

0
source share
1 answer

You seem to be using Office Add-In for Office, which supports PDF 2.0 support.

You need to (re) install and upgrade the version of this add-in for Office 2010. And everything will work again and again.

Regards, Arthur Mustafin

Follow the white command line on google.com followed by SaveAsPDFandXPS ...

PS

In addition, your Addins for Office 2007 will no longer work for Office 2010 because COM interfaces, APIs have changed, some behavior of existing methods is no longer supported, other interfaces are implemented. Stay tuned with Microsoft Connect.

Hope this helps.

+1
source

All Articles