Hosting Infopath in windows/PDF Export

M

MikeAtEnbridge

I'm trying to build an app that involves hosting Infopath 2007 in a winform
app. I'm having no end of difficulties. I really wish microsoft would dump
com interfaces once and for all, they are nothing but trouble.

The specific problem I'm dealing with now is export to pdf. I'm using a call
that looks like

formControl1.XmlForm.CurrentView.Export(_u.AbsoluteUri, ExportFormat.Pdf);

At first, this failed all the time, with no helpful message. I finally
discovered that 1) I haqd to install an add on to infopath 2) I had to
publish the template with full trust so that it could write files.


Now, 2 of my 3 forms I'm testing with work. The third, and any more test
forms I create, fail. I can't find any difference between the forms that work
and the ones that don't..

The error I am getting is an 'exception of type 'System.ArgumentException'
occurred in Microsoft.Office.InfoPath.Client.Internal.Host.dll'

Can anyone give me any ideas of what might be going on? Any idea of how to
debug further?

Does anyone even know of a decent sample on the web of using the infopath
formcontrol? By decent I mean something beyond how to stick the control in
the window and load a document. That is the easy part.

Thanks for your help.
 
G

Gavin McKay

Hello,

Can you reply with your current software settings i.e. InfoPath 2007 service
pack 1? You mentioned an "add-on" which one are you using?

I haven't hosted InfoPath before, always used Forms Services. If you get
*really* stuck maybe it would be easier to host the forms service-provided
html version of your form instead? That would mean you don't have to install
InfoPath on all PCs that need to use it, but of course then you need an
InfoPath Forms Service install somewhere... life is full of wonderful choices
:)

HTH

Gavin.
 
M

MikeAtEnbridge

Latest infopath. The add on is the Office xps and pdf add on. Apparently save
as pdf was not included in the core product due to issues with adobe.


I probably would find working with the web form version a lot easier, but I
need to be able to run in a disconnected mode. The user may be in the field
on a laptop, without access to the network.

THanks, though. I will see how critical the disconnected aspect is. I still
think the formcontrol needs some fixes.
 
C

Clay Fox

An other option might be printing to PDF.

Somewhat low tech but can be done via a command script or batch process.
 
G

Gavin McKay

Another option may be to not host the control in a Windows form at all. A
colleague of mine wrote a system that had a simple .NET front end that listed
the available forms and when the user clicked on the item it instantiated
Infopath so it opened by itself, rather than embedded. That means you have
to make sure the form is published, safe, trusted etc etc but sounds like you
already have that side of things under control.

That way you just need to store the Xml from the form(s) in one location and
they can be saved and managed by a little .NET app. Might take away the
issues of hosting the control.

Gavin.
 

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