Export Infopath to PDF in the background

T

Thea Schmidt

Hi!

I'm trying to export an Infopath-Form to PDF/XPS with Managed Code. I've
installed the Infopath 2007 - Addin
and was succesful this way:

infPath = @"C:\toexport.xml";
Microsoft.Office.Interop.InfoPath.Application InfApp = new
Microsoft.Office.Interop.InfoPath.Application();
XDocument InfXDoc = InfApp.XDocuments.Open(infPfad, (int)
XdDocumentVersionMode.xdCanOpenInReadOnlyMode);
InfXDoc.View.Export(@"C:\exported.pdf", "PDF");
InfXDoc.View.Export(@"C:\exported.xps", "XPS");
InfApp.Quit(true);
InfApp = null;

There ist only one fault: Infopath opens an application window and shows the
form. Does anybody knows a way to access the file without the window?
And can i select the view i want to export? Seems it always takes the
standard-view?

Thank You!
 
T

Thea Schmidt

Hello!

Thanks for your post, Kalyan. It may be a solution, but it seems to be a
long detour. Is there no easier way? A secret parameter for the method "open"
or something like that?

Regards

Thea
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top