Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / November 2006

Tip: Looking for answers? Try searching our database.

Convert InfoPath form to PDF programmatically

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
serious-sam - 05 Oct 2006 07:48 GMT
Hello,

I'm looking for a way to convert an InfoPath form to PDF
programmatically.  I can see there is an export to to PDF feature in
InfoPath.  Is this exposed in any way to the outside world?

I know I could use a third-party XML to PDF converter, but I would like
the output to be the same as the original InfoPath form (with minimum
effort :))

Cheers and regards,
Misha
S.Y.M. Wong-A-Ton - 05 Oct 2006 07:56 GMT
Switch to InfoPath 2007; you can use it to call the export to PDF
functionality in code and convert your form to PDF.
---
S.Y.M. Wong-A-Ton

> Hello,
>
[quoted text clipped - 8 lines]
> Cheers and regards,
> Misha
S.Y.M. Wong-A-Ton - 05 Oct 2006 08:01 GMT
Get the object model poster for InfoPath 2007 here:
http://www.microsoft.com/downloads/details.aspx?FamilyId=771AEB45-9D27-4D1F-ACD1
-9B950637D64E&displaylang=en

---
S.Y.M. Wong-A-Ton

> Hello,
>
[quoted text clipped - 8 lines]
> Cheers and regards,
> Misha
serious-sam - 05 Oct 2006 10:07 GMT
Hello,

Thank you for your advice.  I've created a sample Windows application
that performs the conversion, using the object model you have guided me
to.

The source, for anyone who is interested, goes along these lines:

       private void btnConvert_Click(object sender, EventArgs e)
       {
           try
           {
               formControl1.XmlForm.CurrentView.Export(s_filenameOut,
                   ExportFormat.Pdf);
           }
           catch (Exception ex)
           {
               MessageBox.Show("Error: " + ex);
           }
       }

       private void btnOpen_Click(object sender, EventArgs e)
       {
           try
           {
               formControl1.Open(s_filenameIn);
               formControl1.XmlForm.CurrentView.ForceUpdate();
           }
           catch (Exception ex)
           {
               MessageBox.Show("Error: " + ex);
           }
       }

Fairly simple and convenient.  This is in a Windows application.  I
have a question:

Is it possible to do this from the command line?  All the articles I've
come across relate to the Microsoft.Office.InfoPath.FormControl object,
which is a Windows form component.  I'm unable to use it from a command
line application.  Is there a way I could do this?

Thank you for your help.

Cheers and regards,
Misha

> Get the object model poster for InfoPath 2007 here:
> http://www.microsoft.com/downloads/details.aspx?FamilyId=771AEB45-9D27-4D1F-ACD1
-9B950637D64E&displaylang=en

[quoted text clipped - 13 lines]
> > Cheers and regards,
> > Misha
S.Y.M. Wong-A-Ton - 06 Oct 2006 07:29 GMT
I haven't tried it before, so I wouldn't know. Regarding articles: Remember
that InfoPath 2007 is still in beta, so it is early to expect to see many
articles on the product.
---
S.Y.M. Wong-A-Ton

> Hello,
>
[quoted text clipped - 60 lines]
> > > Cheers and regards,
> > > Misha
RickH - 28 Nov 2006 07:30 GMT
Anything you can run as a batch you can run as a Windows program, and
gain flexibility...

Unfortunately, I have to use Infopath 2003 to convert a bunch of
Infopath Report views into a PDF or Word document.
Right now, I export from Infopath to a MHT file. Then I open it in IE
and use Acrobat to convert to PDF.
Takes forever to combine about 30 Infopath views to one large PDF file.
And I have several EOY reports like this to do.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.