Subscribe to News feed

Converting multiple SharePoint files to PDF Format using Nintex workflow

Posted at: 18:37 on 10 December 2010 by Muhimbi

Nintex logoAlthough I have only recently started using Nintex Workflow, I have completely fallen in love with it. What used to be painful to achieve in SharePoint Designer has become absolute child’s play when using Nintex Workflow, especially in combination with the PDF Converter For SharePoint’s native Nintex support.

In addition to the PDF Conversion Workflow Activity described in this post, Nintex activities for PDF watermarking, PDF security, PDF merging, HTML to PDF conversion and more.

Let’s illustrate the power of these combined tools using an example that is very difficult to achieve in SharePoint designer: Act on a set of list items. In this example, which took only 5 minutes to create, a workflow retrieves all files modified during the current day and converts them to PDF. Ideally you would schedule this workflow to run off-peak to batch process all new and modified files.

Please follow the instructions below or download the complete workflow in NWF format.
 

Multiple-filesThe finished workflow – BRILLIANT!

 

Prerequisites

Before we start building the workflow, please make sure all prerequisites are in place. It is also assumed that the reader has some knowledge of building Workflows using Nintex Workflow.

  1. Make sure the PDF Converter for SharePoint version 4.1 (or newer) is installed in line with chapter 2 of the included Administration Guide. 
     
  2. Naturally Nintex Workflow will need to be installed as well. Nintex Workflow version 2007, 2010 and 2013 are supported.
     
  3. Make sure the Muhimbi.PDFConverter.Nintex.WebApp SharePoint Feature is activated on the relevant Web Application using SharePoint Central Administration.
     
  4. The user (you) will need to have the appropriate privileges to create workflows.

 

 
 
Creating a new workflow

To get started, create a new workflow and choose the blank template. Make sure the workflow doesn’t start automatically and add the workflow variables listed in the following screenshot.

Workflow-Variables

Please make sure that the appropriate data types are assigned (They are listed between round brackets behind each variable name). The names are largely self describing, but some additional information is provided below:

  • Source Item ID: By default the item that triggered the workflow is converted to PDF format. However, as we are iterating over multiple items we need to specify the ID of the item to convert in this variable. In SharePoint 2010 / 2013 select Integer as the Type, not List Item ID.
     
  • Source List ID: The PDF Converter assumes the item that is being converted is located in the same list the workflow is attached to. However, if this is not the case then the ID (a GUID) of the list will need to be specified as well. In this example everything is located in the same list so this variable is not actually used.
     
  • Source Files: As we are potentially converting multiple files we need to define a variable of type Collection to hold the list of files we’ll be iterating over.
     
  • Generated PDF Item ID: Once a file has been converted to PDF, you may want to carry out additional actions on this new file, for example checking it in. Once converted, the ID of the PDF is automatically stored in this variable. In SharePoint 2010 / 2013 select Integer as the Type, not List Item ID. This example uses the (Legacy) Convert to PDF Workflow Activity, if you use the newer Convert Document activity then please take into account that the Generated PDF Item ID is of type Text. If you wish to pass this ID into a secondary activity then you may need to convert it to the correct data type using the Convert Value Workflow Activity. An example can be found here.
     
  • Generated PDF List ID: As the PDF Converter allows files to be written to different document libraries, and even completely different Site Collections, you may want to know the ID of the destination list.

 

Adding the workflow actions

We are now ready to add the actions to the workflow. Begin by adding a Query List action, which will allow us to retrieve all files modified today and store the results in the Source Files collection.

Query-List

Please fill out the settings for this action as in the screenshot listed above. You may want to add an additional filter rule to check that Content Type is not equal to Folder or Document Set.
 

Continue by adding the For Each action to the workflow. Specify the name of the collection to iterate over and the name of the variable to store the Item’s ID in.

For-Each

 

The next set of actions will all need to be added inside the For Each action, to make sure they are executed separately for each file in the list.

We want to make sure that we only invoke the PDF Converter for files that are not already in PDF format, so add a condition and check that the file type equals ‘pdf’ as per the following screenshot.

Set-Condition

 

Add the Convert file to PDF action listed under the Muhimbi PDF section to the No branch of the condition (type is not pdf). Fill it out as per the left most image in the following screenshot.

Convert-PDFThe PDF Converter integrates with Nintex Workflow 2007 & 2010.
 

You may want to leave the Destination Path empty, which will write the PDF File to the same location as the source file. For more information about the Destination Path or any of the other fields, hover the mouse over the small information icons.

The workflow is now done. You may want to add some tracking information using the Log In the History List action. In our example we use the following 2:

  • Last action in the No branch:
    List ID: {WorkflowVariable:Generated PDF List ID} - List Item ID: {WorkflowVariable:Generated PDF Item ID}
     
  • Last action in the Yes branch:
    Already in PDF Format: {WorkflowVariable:Source Item ID}

 

Running the workflow

Finalise the workflow by saving and publishing it, after which it is ready to be executed.

You can either run the workflow manually or schedule it to run at a time of your choice.

.




Labels: , , , , ,

28 Comments:

  • Can you convert multiple documents into one PDF file?

    By Anonymous Anonymous, At 30 December, 2010 15:46  

  • Yes you can merge documents, but at the moment it requires one of our other products as well. See the following post and contact us using the 'Contact Us' link at the top of the page if you have any questions:

    http://blog.muhimbi.com/2010/05/combining-multiple-pdf-files-using.html

    By Blogger Muhimbi, At 30 December, 2010 16:55  

  • Do you have any plans to integrate with K2 Blackpoint?

    By Anonymous Anonymous, At 07 January, 2011 04:25  

  • We implement new features based on customer demand. Please contact us using the 'contact' link at the top of the page.

    By Blogger Muhimbi, At 07 January, 2011 08:37  

  • Can you create PDF/A single or multiple page document?
    Thanks

    By Anonymous Anonymous, At 01 April, 2011 00:57  

  • We can convert to PDF/A for most of the document types. Not sure what you mean by 'multiple page document', most documents have multiple pages, so I think the answer is 'yes'.

    If you need further details then please use the 'contact us' link at the top of the page. We always respond quickly.

    By Blogger Muhimbi, At 01 April, 2011 08:13  

  • Does your product and nintex workflow can convert an infopath form to PDF?

    By Anonymous Anonymous, At 27 April, 2011 17:30  

  • InfoPath conversions are fully supported via Nintex Workflows, SharePoint Designer Workflows, conversions using the SharePoint user interface as well as via web service calls.

    For details see http://blog.muhimbi.com/2011/04/pdf-converter-for-sharepoint-recorded.html

    By Blogger Muhimbi, At 27 April, 2011 17:32  

  • Does the nintex activity supports HTML page to PDF?
    If yes, we're buying it now!! :)

    By Anonymous Anonymous, At 29 April, 2011 00:18  

  • Regarding HTML to PDF. Currently the Nintex Activity we provide can deal with converting HTML files if they are stored in a document library, basically like any other file. However, if you need to convert a URL then you will need to invoke our 'SharePoint Designer HTML Activity' from your Nintex workflow, which is easy to do. (see http://blog.muhimbi.com/2010/08/converting-sharepoint-lists-to-pdf.html)

    A native Nintex workflow activity to convert URLs to PDF will be released in the next few months. Upgrades will be free.

    By Blogger Muhimbi, At 29 April, 2011 08:54  

  • Does the Nintex/Muhimbi action support watermarking and/or printing the PDF?

    By Anonymous Anonymous, At 24 August, 2011 20:54  

  • Watermarking is supported using various mechanisms, see http://blog.muhimbi.com/2010/10/watermarking-features-of-muhimbi-pdf.html

    Printing is not supported at the moment.

    By Blogger Muhimbi, At 25 August, 2011 07:44  

  • I have followed all the Prerequisites steps, however, I still do not see the Muhimbi PDF section and Convert file to PDF action listed in Nintex.

    By Anonymous Anonymous, At 13 September, 2011 21:56  

  • Did you enable the 'Muhimbi PDF Converter - Nintex Workflow Integration' Feature on the Web Application? If you are still getting problems then please contact us at support@muhimbi.com.

    By Blogger Muhimbi, At 14 September, 2011 08:54  

  • Can you push additional Meta Attributes to the PDF such as if I wish to create an Atribute called CaseID and store that as part of the PDF

    By Anonymous David Aronberg, At 23 May, 2012 17:08  

  • Hi David,

    Additional meta data can be copied to sharepoint columns or embedded in the PDF using watermarks using any of our comprehensive watermarking facilities. For details see http://blog.muhimbi.com/2010/10/watermarking-features-of-muhimbi-pdf.html

    By Blogger Muhimbi, At 23 May, 2012 18:09  

  • Hi
    i download your zip file and import to my Shared Documents library. I become everytime this error when i start the workflow. Do you have an idea. Thank you

    System.Exception: An error occurred while converting a file to PDF format using a Workflow:
    - ListID: 08dcca05-cd28-4cec-bf55-b33c2f872ef1
    - ItemID: 23
    - DestinationURL: Shared Documents/PDF
    - DestinationFileName:
    - MetaData: False ---> System.NullR

    By Blogger Arash Alvandi, At 13 August, 2012 17:46  

  • Hi Arash,

    Please make sure the software is installed exactly as described in chapter 2 of the Administration Guide. Please follow that guide to the letter and make sure you follow the link to ‘Appendix - Installing converter dependencies’.

    The Administration Guide is included in the download and available on-line at http://www.muhimbi.com/support/documentation/PDF-Converter-for-SharePoint/Administration-Guide.aspx

    If you are experiencing any problems after installation then please see http://support.muhimbi.com/entries/21275143-validating-converters-and-troubleshooting-errors.

    Please contact support@muhimbi.com i you have any more questions.

    By Blogger Muhimbi, At 13 August, 2012 17:56  

  • Hello,

    I see a possibility to convert (to pdf) documents in Document libraries.
    But is it possible to convert attachments of List items, using Nintex Workflow 2007?

    By Anonymous Andrius, At 15 March, 2013 08:33  

  • Our Merge Activity allows paths to List Items to be specified, you can find some information at http://blog.muhimbi.com/2011/11/specifying-paths-and-file-names-when.html.

    The best thing to do in my opinion is to use Nintex Workflow to extract the attachment from the list item and save it in a (hidden) Document library. Then convert the file there.

    By Blogger Muhimbi, At 15 March, 2013 15:41  

  • Hi,

    Can we convert list items with or without attachments into PDF using Muhimbi. We already have muhimbi installed and working for documents and libraries. I am unable to find anything about list item level PDF conversion.

    Parul

    By Anonymous Anonymous, At 10 January, 2014 06:15  

  • Hi,

    If you are an existing customer then your best bet is to contact our support desk at support@muhimbi.com.

    With regards to your question, it is possible to convert a list items including attachments. For details see http://support.muhimbi.com/entries/30499797-Convert-a-List-Item-including-all-attachments-to-PDF

    By Blogger Muhimbi, At 10 January, 2014 09:26  

  • We seem to be experiencing problems with the merging, on a project I am working on, and perhaps your solution in the answer. Following are the problems:

    Background: different news articles are created on SharePoint and because we'd like to send these to clients that have no access to our intranet, then we wish to merge these articles into one document (e.g. PDF, which is our preference and what we're trialing) and email the merged articles in one file.

    Problems: after merging the articles into a PDF file, some formatting (i.e. image positions, tables used to arrange articles into two columns) gets lost, if there is a space for one line at the end of the page, only the title of the article will appear there and the rest continue on the second page, and most frustratingly, the images - which would've lost their original position - shift to the top of the text (from right/left) to the top of page and this pushes the text out.

    So, do you have a solution for these. Or rather, is there a way to merge the articles into one html file instead?

    By Anonymous Anonymous, At 10 July, 2014 15:30  

  • Please contact support@muhimbi.com. Please note that HTML is not really a language that is particularly suited to generate print output (and therefore PDF). Having said that, we try to make the most of it.

    By Blogger Muhimbi, At 10 July, 2014 15:53  

  • How long does it take for one file to be converted into a PDF?

    By Anonymous Anonymous, At 09 January, 2015 16:33  

  • How long is your source document :-)

    It depends on the file type, complexity, hardware, etc. You can find a great article about it at http://support.muhimbi.com/entries/21259703-How-well-does-the-PDF-Converter-scale-deal-with-high-load-

    In summary, it is extremely fast and scales very well.

    By Blogger Muhimbi, At 09 January, 2015 16:51  

  • We just received this great tool but i was wondering. We convert a document to PDF into another Library which works fine. But if i change the original one (other MEtadata) it creates another PDF instead of updating the old one. Is there an option to override like when using the Nintex action Copy Item?

    By Anonymous Anonymous, At 11 October, 2017 14:29  

  • Not 100% sure what you mean, but our software fits in with SharePoint's standard model, so please drop support@muhimbi.com a line for details. They are there to assist with questions such as this one.

    By Blogger Muhimbi, At 11 October, 2017 14:55  

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