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: , , , , , , ,

Converting SharePoint Lists to PDF format using a SharePoint Designer Workflow

Posted at: 16:52 on by Muhimbi

List As one of the leading vendor in the SharePoint PDF Conversion market, we are frequently asked about how our products can be used to convert a SharePoint List into a PDF file. Up until now we have never had a good answer to this question as we mainly deal with the conversion of Office Documents and InfoPath forms.

However, as the new “4.0” version of the PDF Converter for SharePoint and PDF Converter Services support the conversion of HTML based content we can now export any SharePoint page, including ones that contain all entries in a list, to a PDF Document. This article shows how to put this together.
 

OK, let’s get going. In this example we use a simple Tasks list, so open your SharePoint site and create a Tasks lists if one doesn’t already exists.

Next up we need to create a page that displays all items in the list with as little of the SharePoint User Interface around it as possible. We could just use the list’s default view, but that would convert the Quick Launch menu to PDF as well, which doesn’t look very clean. To create a new page without the Quick Launch menu follow these steps:

  1. Navigate to the View All Site Content screen and click the Create button.
     
  2. In the Web Pages column select Web Part Page.
     
  3. Name the page PDFTasks.aspx, choose the Full Page, Vertical template and click the Create button.
     
  4. On the newly created page click Add a Web Part and add the Tasks list.
     
  5. Click the newly inserted Web Part’s Edit button and select the Modify Shared Web Part option.
     
  6. Click Edit the current View and select the columns you want to be included in the PDF file. For example % Complete, Due Data, Start Date and Status. Do not close the screen yet.
     
  7. Under the Item Limit section set the limit to an appropriately large number. We don’t want to page through the data in batches as we want to include all items in the PDF file.
     
  8. Click OK to save the changes.
     
  9. Save the page’s URL as we need it later. E.g. http://moss/sites/Management/FormServerTemplates/PDFTasks.aspx.

 

This new page will be used as the underlying layout of the PDF document. Feel free to modify it further in SharePoint designer / JQuery and remove more parts of the SharePoint user interface. You could also consider creating a minimalistic master page and applying that to the new PDFTasks page.
 

image

 
With the page in place the next thing we need to do is setup the automatic PDF Conversion using a SharePoint Designer workflow. In this example we generate a PDF file whenever the Tasks list is modified. The generated PDF file is stored in the Shared Documents library. Create the workflow as follows:

    1. Make sure you have the appropriate privileges to create workflows on a site collection.
       
    2. Create a new workflow using SharePoint Designer.
       
    3. On the Workflow definition screen associate the workflow with the Tasks list, tick the boxes next to both ‘Automatically start….’ options and proceed to the next screen.
       
    4. Add the Convert HTML to PDF action and click on this url and enter the URL to the page that was created in a previous step, e.g. http://moss/sites/Management/FormServerTemplates/PDFTasks.aspx.
       
    5. Click this file and enter the path and file name where the PDF file will be generated, e.g. Shared Documents/Tasks.pdf.
       
    6. Optionally change the generated page’s orientation from Portrait to Landscape.
       
    7. The user name and password are optional. By default the credentials the Muhimbi Conversion Service runs under will be used to open the web page. For now leave it empty.
       
    8. Click the Finish button to activate the workflow.

 

image

 

As a test enter one or more tasks. Every time a task is added or updated a PDF file is written to Shared Documents/Tasks.pdf. Open the PDF file to see the results.

 

In summary, the HTML conversion capability of the new version opens up a whole array of new possibilities.  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: , , , , , ,

Controlling which views to export to PDF format in InfoPath

Posted at: 15:08 on 20 August 2010 by Muhimbi

View

Next up in our series about new features in the PDF Converter for SharePoint 4.0 and PDF Converter Services, we’ll showcase some of the new Export to PDF View Selection capabilities of our InfoPath converter.

Being able to select which views to export is very useful as quite often different views are used for exporting a form to PDF. Sometimes using the Print View is good enough, but other times you need to export a different view or multiple views to PDF format. There are even occasions where different views are exported depending on the state of the data entered in the form.

As always, the best way to illustrate this is by example.

 

Use a special view for exporting to PDF

In this scenario we have an Employee Review form with the following 3 views:

  1. Data entry view: A view used for populating data using the InfoPath client or Forms Services. This is the default view.
  2. Print View: A special view that is optimised for printing to a network laser printer. This is specified as View 1’s Print View.
  3. PDF Export view: A separate view that is used to export the InfoPath form to PDF format as it contains some information that should only show up in exported PDF files.


As View 1 is the default view and View 2 is the Print View for View 1, under normal circumstance the 2nd view is used for exporting to PDF. However, we want to use View 3 for this purpose. We can achieve this by starting the name of View 3 with “_MuhimbiView”. The Muhimbi PDF Converter will automatically detect all views that start with this name, export them all and merge them together into a single PDF file. Naturally these views can be hidden from the end user by marking them as such.

InfoPath-Views  
This is a great solution if you know beforehand that you will always be exporting the same view(s) to PDF format.

 

Determine at runtime which views to export

The previous solution, using view names that start with “_MuhimbiView”, works great. However, sometimes you need to export a different view depending on the state of the data.

For example, our Expense Claim form consists of the following Views:

  1. Data Entry View 1: Used by the employee to report expenses.
  2. Data Entry View 2: Used by the manager to add comments and additional information.
  3. PDF Export View 1: The view that is used to export the form to PDF format before the manager has reviewed the form.
  4. PDF Export View 2: The view that is used to export the form to PDF format after the manager has reviewed the form.

 

OK, so how are we going to deal with this? Well, here comes the Muhimbi PDF Converter to the rescue! By adding a (hidden) text box named “_MuhimbiViews” (case sensitive and using the default ‘my’ namespace) to any of the views and populating it with the name of one or more comma separated view names, the Muhimbi PDF Converter will automatically pick up these names and export them to PDF format. If multiple views are specified then they are automatically concatenated together.

In addition to adding the “_MuhimbiViews” text field to the form, all the developer of the form needs to do is to add a little bit of logic to the Submit event of the 2 data entry views that specify the correct view name to export in the “_MuhimbiViews” field.

For details about how to dynamically specify which views to convert from your workflow see this post.

 

View prioritisation rules

To determine which view or views to export, the Muhimbi PDF Converter uses the following prioritisation rules:

  1. Regardless of how a view or views are selected for export, if the selected view has a Print View specified than that view is given priority.
  2. Version 4.1 and up: When using the web services interface, any ConversionViews specified in the ConverterSpecificSettings property will be converted. If this property is not set then the following rules will be used to determine which views to convert to PDF. A Web Services example can be found here.
  3. If a field named “_MuhimbiViews” is found anywhere in the InfoPath form then the content of this field is used to determine which views to export.
  4. If the previous field does not exist, is empty or the specified view name does not exist then the converter looks at all view names that start with “_MuhimbiView”.
  5. If none of the previous options apply then the view marked as the Default View is exported.

 

Do not use Muhimbi’s View selection features in combination with InfoPath's 'Print multiple views' facility. The latter is given priority when converting to PDF.

When the final PDF file is assembled then all selected views are included first, followed by any converted attachments.

 

Rules when converting to formats other than PDF

As of version 6.0, Muhimbi’s PDF Converter can also convert InfoPath forms to MS-Word, Excel and HTML. There are some exceptions to the way View Selection works for these output formats. For details see this post.

 

In summary, the new version of the PDF Converter adds flexible View selection features to make the life of InfoPath developers easier. 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: , , , , , ,

Programmatically Converting Web / HTML pages to PDF format

Posted at: 15:12 on 19 August 2010 by Muhimbi

html

As part of our on-going series about new features in the PDF Converter for SharePoint 4.0 and PDF Converter Services, we would like to showcase our exciting new HTML to PDF conversion functionality.

Please note that this article mentions SharePoint as well as .NET a number of times. Rest assured that, as the PDF Converter Services is Web Services based, it works just as well from Java, C#, Ruby and other web services capable environments.

We anticipate that most of our customers will use this functionality to convert SharePoint pages, including lists, to PDF format. However, rather than displaying a boring old SharePoint site, let’s show how well this works with a real website, in this case one of our landing pages.

UPDATE: A workflow activity is now available as well for converting HTML to PDF as is an update for the SharePoint User interface to convert SharePoint pages to PDF format.

The following image shows the original HTML page on the left hand side and the converted PDF file on the right. As you can see this works very well.
 

HTML-to-PDF Example of the original web page (left) and the converted PDF file (right)

 
A summary of the new HTML features are as follows. Although this new functionality is available in both the PDF Converter Services as well as the PDF Converter for SharePoint, some of the more SharePoint centric features in the list are obviously exclusive to the SharePoint version.

  1. Built on top of Muhimbi’s rock solid service platform. No need to worry about runaway or orphaned processes. Everything is nicely controlled and scales over multiple CPUs and conversion servers.
     
  2. Integrates with the full feature set of Muhimbi’s PDF Conversion platform including full control over watermarks as well as PDF Security settings.
     
  3. High fidelity conversion (See image above) including multi page documents and JavaScript output. The generated PDF file contains real (searchable) text and is not just a low resolution screenshot of the converted web page.
     
  4. Supports conversion by URL as well as manually specified HTML fragments. Ideal for creating PDF based reports using generated HTML tables.
     
  5. Convert HTML documents stored inside SharePoint document libraries.
     
  6. Convert SharePoint pages to PDF format from the user’s Personal Actions menu.
     
  7. Convert web pages to PDF format from SharePoint workflows. Works great in combination with publishing sites.

 

HTML to PDF Conversion is accessible via the web services based interface as well. Listed below is a simple C# example of how to carry out a conversion from your own code. The code is not complete as it calls into some shared functions from our main C# example to keep things short.

Our existing Java based examples can easily be extended to carry out the same type of conversions. Contact us if you need a hand, we love to help and are very responsive.
 

/// <summary>
/// Simple sample to convert either a URL or HTML code fragment to PDF format
/// </summary>
/// <param name="htmlOnly">A flag indicating if an HTML Code fragment (true)
/// or URL (false) should be converted.</param>
private void ConvertHTML(bool htmlOnly)
{
    DocumentConverterServiceClient client = null;
 
    try
    {
        string sourceFileName = null;
        byte[] sourceFile = null;
 
        client = OpenService("http://localhost:41734/Muhimbi.DocumentConverter.WebService/");
 
        OpenOptions openOptions = new OpenOptions();
 
        //** Specify optional authentication settings for the web page
        openOptions.UserName = "";
        openOptions.Password = "";
 
        if (htmlOnly == true)
        {
            //** Specify the HTML to convert
            sourceFile = System.Text.Encoding.UTF8.GetBytes("Hello <b>world</b>");
        }
        else
        {
            // ** Specify the URL to convert
            openOptions.OriginalFileName = "http://www.muhimbi.com/";
        }
        openOptions.FileExtension = "html";
        //** Generate a temp file name that is later used to write the PDF to
        sourceFileName = Path.GetTempFileName();
        File.Delete(sourceFileName);
 
        // ** Enable JavaScript on the page to convert. 
        openOptions.AllowMacros = MacroSecurityOption.All;
 
        // ** Set the various conversion settings
        ConversionSettings conversionSettings = new ConversionSettings();
        conversionSettings.Fidelity = ConversionFidelities.Full;
        conversionSettings.PDFProfile = PDFProfile.PDF_1_5;
        conversionSettings.PageOrientation = PageOrientation.Portrait;
        conversionSettings.Quality = ConversionQuality.OptimizeForPrint;
 
        // ** Carry out the actual conversion
        byte[] convertedFile = client.Convert(sourceFile, openOptions, conversionSettings);
 
        // ** Write the PDF file to the local file system.
        string destinationFileName = Path.GetDirectoryName(sourceFileName) + @"\" + 
                                            Path.GetFileNameWithoutExtension(sourceFileName) + 
                                            "." + conversionSettings.Format;
        using (FileStream fs = File.Create(destinationFileName))
        {
            fs.Write(convertedFile, 0, convertedFile.Length);
            fs.Close();
        }
 
        // ** Display the converted file in a PDF viewer.
        NavigateBrowser(destinationFileName);
    }
    finally
    {
        CloseService(client);
    }
}

All in all some pretty exciting functionality. Don’t hesitate to leave a comment below if you have any questions or contact us to discuss any of our products.

.

Labels: , , , , , ,

Converting InfoPath forms including all attachments to a single PDF file

Posted at: 11:15 on by Muhimbi

Attachment Over the next few days I will be writing about the new features in our the PDF Converter for SharePoint 4.0 and PDF Converter Services. As this release is a big one it won’t all fit in one post, so stay tuned and consider subscribing to our RSS feed or follow us on Twitter.

In today’s post I will explain the new functionality that allows files attached to InfoPath forms using the File Attachment control to be converted to PDF together with the main InfoPath form. All files will be merged into a single PDF file that contains both the InfoPath form and all attachments.

 

This all works amazingly, in summary the functionality is as follows:

  1. Automatic attachment conversion is enabled by default. Change the InfoPathConverterFullFidelity.ConvertAttachments setting in the Muhimbi service’s config file to False to disable conversion of attachments.
     
  2. You don’t need to know anything about the form that is being converted, nor do you need any programming knowledge, this functionality is truly universal. All attachments located on the views that are being converted are automatically picked up, including attachments in Repeating Sections and Repeating Tables. Attachments located on views that are not being converted are automatically skipped.
     
  3. All document types supported by the Muhimbi PDF Conversion engine are recognised. Files that are not supported are automatically skipped. For a full list of supported file formats see the Specification tab on the main product page.
     
  4. Naturally attached PDF files are merged in as well, which is great for such attachments as scanned receipts or received faxes.
     
  5. Do not attempt to attach an InfoPath form inside another form. This will result in an error.
     
  6. This functionality works hand-in-hand with the new Export Multiple Views functionality that I will outline in an upcoming post.
     
  7. As all this work is carried out inside Muhimbi’s core conversion engine, any additional conversion settings such as watermarks and security settings are automatically applied to all pages of the combined PDF file.

 image Convert Expense Reports with attached receipts to a single PDF

 
So, a very useful new feature that provides powerful new functionality to our customers. As always, upgrades are completely free. Don’t hesitate to leave a comment below if you have any questions or contact us to discuss any of our products.

.




Labels: , , , , , ,

Dealing with hyperlinks when converting InfoPath files to PDF format

Posted at: 18:58 on 18 August 2010 by Muhimbi

infopath_logo We get a lot of questions from customers about what happens to hyperlinks in InfoPath documents when the documents are converted to PDF format using the Muhimbi PDF Converter for SharePoint.

We ran the possible combinations through some tests with the following results:

  1. InfoPath TextBox elements with the type set to 'text' become hyperlinks when a URL is entered in it (or at least the PDF Reader navigates to that URL when clicked).
     
  2. InfoPath TextBox elements with the type set to 'URL' become hyperlinks when a URL is entered in it (or at least the PDF Reader navigates to that URL when clicked).
     
  3. Entering a URL in an InfoPath Rich Text Box and pressing the Enter key automatically generates a blue hyperlink. When a document containing this link is converted to PDF format then the link can be clicked in the converted document as well. 
     
  4. Entering text in an InfoPath Rich Text Box, selecting it and using the Insert Hyperlink command creates a clickable link in the InfoPath Document. However, after converting this document to PDF format this link is not clickable. 
     
  5. InfoPath Hyperlink Fields are correctly converted and remain hyperlinks in the PDF document.

 

I hope this clarifies the situation.

.





Labels: , , , ,

Workflow Power Pack 1.2.0.6 – Patch release for SharePoint 2010

Posted at: 11:45 on by Muhimbi

WPPBox

We just published a patch release of the Workflow Power Pack for SharePoint. No new functionality, just a fix to deal with what we believe to be a bug in the way SharePoint 2010 deals with custom Workflow Activity Validators.

Due to the manner SharePoint 2010 deals with lookup fields in custom activity validators, any custom code that contains lookup values (e.g. [%Current Item:Transaction Date%]) will not be validated when a workflow is published. We believe this to be a bug in SharePoint 2010 as this works fine in SharePoint 2007.

If this is a big problem for you then consider passing in the lookup field as either parameter 1 or parameter 2 and refer to it using MyWorkflow.Parameter1. For details on how to use the MyWorkflow object in your own code, see the User Guide Series.

Code that does not contain lookup fields is validated properly. Regardless of the scenario, the code does execute correctly.

SharePoint 2007 environments are not affected by this bug.

Download the latest version.

.






Labels: , , , ,

SharePoint Infuser, URL Shortener & Workflow Power Pack Webinar recording

Posted at: 08:30 on 11 August 2010 by Muhimbi

The 3rd recording in our series of SharePoint webinars is now available for download / streaming. This final recording discusses and demonstrates the free Muhimbi SharePoint Infuser in addition to the URL Shortener for SharePoint and the Workflow Power Pack

The other 2 recordings, dealing with our popular PDF Converter for SharePoint and the SharePoint Audit Suite, are available for viewing as well. 3 Webinars in one week….. I am knackered.
 

image

 

Download / stream the presentation in WMV format. The slides are also available in PDF format.

Some of the demos featured in the presentation are also available as separate blog posts:

Workflow Power Pack

 
URL Shortener for SharePoint

 
SharePoint Infuser


Enjoy watching it. As always, if you have any questioned then don’t hesitate to contact us. We are very helpful and answer any questions as quickly as we can.

.






Labels: , , , ,

SharePoint Audit Suite recorded Webinar now available for live streaming

Posted at: 18:51 on 10 August 2010 by Muhimbi

Labels:

Maintenance release for SharePoint Infuser 1.0.1.2

Posted at: 17:50 on 09 August 2010 by Muhimbi

Syringe Just a quick note to announce the availability of a maintenance release of the free Muhimbi SharePoint Infuser.

Nothing too exciting, just a bug fix that affects solutions where a user may have access to a sub site without having access to the root site.

Download it here, check out examples here.

Shortest Muhimbi Blog post Ever!

.





Labels: ,

PDF Converter for SharePoint recorded Webinar now available for live streaming

Posted at: 11:20 on 04 August 2010 by Muhimbi

Labels:

Need support from experts?

Access our Forum

Download Free Trials