Subscribe to News feed

Using SharePoint Forms Services to convert InfoPath forms to PDF format

Posted at: 19:22 on 31 August 2010 by Muhimbi

forms Our popular PDF Converter for SharePoint has been able to convert InfoPath document to PDF format for quite some time and, even though we are continuously improving it with new functionality such as Dynamic View Selection and the ability to convert InfoPath attachments, you just can’t please everyone all the time.

For example, to achieve the best possible conversion fidelity our product requires InfoPath to be installed on the conversion server. This works great, but in some (mainly externally hosted) environments, this is not always possible. Fortunately the 4.0 version of the PDF Converter for SharePoint now comes with support for converting InfoPath forms to PDF format using InfoPath Forms Services, which is included with the Enterprise version of SharePoint 2007 & 2010.

Update (July 2013): We have noticed that some of our customers are under the impression that what is described in this blog post is the recommended way to convert Forms Services forms. That is not the case, the recommended way is to use our standard InfoPath converter to convert these kind of forms. The HTML Conversion option described in this blog post is merely a last resort if all other options fail. Please contact our support desk at support@muhimbi.com if you have any questions.

This can be very useful for some environments, but there are some limitations with this technique:

  1. InfoPath Forms services is required so it doesn’t run on the base WSS3 or SharePoint Foundation versions.
  2. It only works with Forms that are Browser enabled.
  3. Dynamic View Selection and conversion of Attachments features are not available, although it is possible to specify the name of the View to convert.

 
Our traditional approach that uses InfoPath on the server does not have these limitations.
 

image From Browser based form (left) to PDF Document (right). Click image to open the full PDF file.

 
Let’s show how to use Form Services in combination with the PDF Converter for SharePoint to convert InfoPath Documents. Some familiarity with both InfoPath and SharePoint is assumed. If you have any questions after reading this then leave a message in the comments section at the end of this post or contact us.

    1. Make sure you have the appropriate privileges to create workflows on a site collection.
       
    2. Start InfoPath, select Customize a Sample and double click on Sample – Expense Report.
       
    3. From the File menu select Publish and go through the usual steps to publish the form to a new SharePoint Library named Expenses.
       
    4. In the new Expenses document library, fill out a form and save it as Form1.xml.
       
    5. Create a new workflow using SharePoint Designer.
       
    6. On the Workflow definition screen associate the workflow with the new Expenses list, tick the boxes next to both ‘Automatically start….’ options and proceed to the next screen.
       
    7. Add the Convert HTML to PDF action, click this url / html and enter the path to your site collection followed by Muhimbi’s InfoPathPrint.aspx page, e.g. http://moss/sites/Finance/_layouts/Muhimbi.PDFConverter/InfoPathPrint.aspx
       
    8. Don’t close the String Builder dialog yet. Add the xmlLocation querystring parameter, click the Add Lookup button and select the Server Relative URL field for the Current Item. The final result should look like the following screenshot.

      image 
    9. Close the String Builder and click the this file option. Assuming we want to write the converted PDF file to the Shared Documents library enter Shared Documents/[%Expenses:Name%].pdf. (Insert the underlined text using the Lookup button. Just typing it in will not work).
       
    10. Optionally change the orientation of the page to Landscape. There should be no need to specify the username and password as by default the credentials the Document Conversion Service runs under will be used for authentication with the aspx page.
       
    11. Close the workflow to save and activate it.

 

Add a new form to, or update an existing one in, the Expenses library. After a few seconds the Workflow Status should change to Completed. Once complete the converted PDF document can be opened from the Shared Documents library.

If your InfoPath form contains multiple views then you can select which view to convert by concatenating &ViewName=your_view_name to the URL of InfoPathPrint.aspx.

 

In summary, if it is not possible to install InfoPath on the server in your environment, or if your forms look better in Forms Services compared to the full InfoPath client (it does happen), then use the technique described in this post to convert InfoPath documents to PDF format using InfoPath Forms Services.

As always, upgrades are completely free. Don’t hesitate to leave a comment below if you have any questions or contact us to discuss anything related to our products.

.




Labels: , , , , , , ,

8 Comments:

  • Hi,
    I am sharepoint developer first of all i would like to thanks to your post. I have a same requirement to implement in my current project. I have few doubts to follow the steps defined by you, could you please place any video session to explain the same that would be very helpful.

    Thank you.

    By Anonymous Anonymous, At 27 May, 2011 21:24  

  • Have a look at this webcast, it shows the product in action: http://blog.muhimbi.com/2011/04/pdf-converter-for-sharepoint-recorded.html

    There are also many InfoPath related posts and demos on this site, see http://blog.muhimbi.com/search/label/InfoPath

    By Blogger Muhimbi, At 28 May, 2011 08:12  

  • I want to do something similar to this but I can't use InfoPathPrint.aspx as my data is stored in SQL. At run-time I extract the data and convert it to XML. I then pass this XML to an XMLFormView control on a custom page. So, I have no Form Library list item to pass.

    Can I use your library in this scenario?

    By Anonymous Anonymous, At 19 March, 2012 21:37  

  • I am not 100% sure I understand your scenario, but you should be able to do it with our generic (non forms server based) InfoPath converter. You will need to enable external data connections during conversion, which makes configuration a bit tricky, but is absolutely possible.

    Please contact our support desk using the 'contact us' link at the top of the page and we'll take it from there.

    By Blogger Muhimbi, At 20 March, 2012 10:11  

  • We are looking at batch converting Infopath to PDF. Is there a way to do this without using a workflow but by using c#?

    By Anonymous Anonymous, At 06 June, 2012 15:49  

  • You can do batch conversion from C#, or any other Web Services capable platform, using our comprehensive Web Services interface. For details see http://support.muhimbi.com/forums/20727492-pdf-converter-web-service-interface.

    If you have any questions then drop support@muhimbi.com a line.

    By Blogger Muhimbi, At 06 June, 2012 16:00  

  • hi, i have requirement like when ever a user submit a infopath form2010 it should get convert into word2010 document or pdf document. that document should populate automatically..please help me its an urgent requirement

    By Anonymous bobby, At 03 June, 2013 08:13  

  • Hi Bobby,

    That is exactly what our software does (See http://blog.muhimbi.com/2012/02/convert-document-types-using-pdf.html). Just download the free trial, install it in line with chapter 2 of the included Administration Guide and then create a very simple SharePoint Designer workflow and within 5 minutes you can convert InfoPath to MS-Word / PDF.

    If you have any questions please contact our support desk at support@muhimbi.com or use the 'Contact Us' link at the top of the page.

    By Blogger Muhimbi, At 03 June, 2013 09:15  

Post a Comment

Subscribe to Post Comments [Atom]

Links to this post:

Create a Link

Need support from experts?

Access our Forum

Download Free Trials