Subscribe to News feed

Using the PDF Converter from a SharePoint workflow

Posted at: 1:02 PM on 16 April 2009 by Muhimbi

workflow

It is always interesting to see how your customers have a completely different look on the fantastic product you have been working on for months. After the initial release of our PDF Converter for SharePoint, the majority of the support calls we received were about how to use the product from a SharePoint workflow. Errrr…… we hadn’t really thought about workflows as it is so un-cool, related to SharePoint designer…and…and…and… actually we had never done much with SharePoint workflows.

As much of our feature set and product development is driven by customer demand, it was time to skill up on workflows and  - dare I say it - SharePoint Designer. And you know what? It is pretty cool!As a result a new, workflow enabled, version of the PDF Converter is now available for download.

What follows is an example of how to create a simple workflow in SharePoint Designer, which converts a file to PDF format as soon as it has been approved. If you prefer to use Nintex Workflow then have a look at this post.

Before you start, make sure the PDF Converter for SharePoint has been installed and you have access to a site collection with the appropriate rights to create workflows. Some basic knowledge about creating and configuring document libraries is assumed.

 

Create and configure the Document Library
 

  1. Create a document library named ‘Important Documents’.
     
  2. Once created, enable ‘Requires content approval’ on the library’s Settings > Document Library Settings > Versioning Settings screen.
     
  3. In the document library, create two folders: ‘Confidential Proposals’ and ‘Approved PDF Files’.
     
     

Create and configure the work flow
 

  1. Start SharePoint Designer and open the site collection that contains the ‘Important Documents’ library. 
     
  2. From the File menu select New > Workflow.
     
  3. On the first screen of the Workflow wizard, specify the following settings:
     
    • Name the workflow ‘Convert Approved documents to PDF Format’.
       
    • Select the ‘Important Documents’ list.  
       
    • When creating a SharePoint Designer Workflow in SharePoint 2013 then please select Platform Type: SharePoint 2010 Workflow.

    • Select the 2nd and 3rd checkboxes to make sure the workflow is triggered whenever a document is created or (its status) is updated.

    • Click the ‘Next’ button to proceed.

     workflow wizard

  4. We are now ready to create the workflow. From the ‘Conditions’ menu select ‘Compare any data source’. This inserts the ‘If value equals value condition.
     
  5. Click on the first ‘value’ followed by the ‘display data binding’ (fx) button.
     
  6. Select ‘Current Item’ as the Source and select ‘Approval Status’ in the Field. Click the OK button to continue.
     
  7. Click on the second ‘value’ and select ‘Approved’ from the list.   
     

 
To avoid that the same workflow is executed on the converted PDF file after the conversion has taken place, we need to specifically exclude pdf files as follows:  

  1. Add another ‘Compare any data source’ condition.
     
  2. Click on the first ‘value’ followed by the ‘display data binding’ (fx) button.
     
  3. Select ‘Current Item’ as the Source and select ‘File Type’ in the Field. Click the OK button to continue.
     
  4. Click ‘equals’ and change it to ‘not equals’.
     
  5. Click on the second ‘value’ and enter ‘pdf’.
     

 
With the Conditions in place we can now add the Actions, which is where the magic happens.

  1. From the ‘Actions’ menu, select ‘Convert to PDF’. It may be hidden behind the ‘More Actions’ option.
     
  2. The following action is inserted:

    Convert this document to this url using the same file name and include / exclude meta data. Store the converted item details in List ID: Variable: List ID, Item ID: Variable: List Item ID.

    Let’s examine what the various options mean:
     
    • this document:  Specify which document to convert. Select the option and make sure ‘Current Item’ is selected.
       
    • this url: Specify the location the converted file will be written to. The following options are available:
       
      • Leave it empty: When no value is specified then the converted document is written to the same folder as where the source file is located.
         
      • Site Relative URL: By specifying a URL relative to the current site, e.g. ‘subsite/shared documents/PDF Files’, any folder location in the current site collection can be targeted. This is the option we want to use so enter Important Documents/Approved PDF Files.
         
      • Web Application relative URL: Using a URL that is relative to the entire web application, e.g. ‘/sites/Press Office/Public Documents/To Distribute’, any folder location in any site collection can be targeted.
                                    
    • the same file name: The name of the converted file can be specified here. In our case we’ll leave it empty to make sure we use the same name as the original document.
       
    • include / exclude meta data: In case of sensitive documents we may want to strip any custom SharePoint columns from the file. Assuming that our document library contains a column ‘Yearly sales forecast’, we want to select ‘Exclude’.  
       
    • Variable: List ID: A new workflow variable named ‘List ID’ is automatically created. After the file has been converted, this variable will contain the ID of the list the converted file was saved to. This can later be fed into another action in order to manipulate this file further.
       
    • Variable: List Item ID: A new workflow variable named ‘List Item ID’ is automatically created. After the file has been converted, this variable will contain the ID of the item the converted file was saved to. This can later be fed into another action in order to manipulate this file further.
  3. Insert a new action named ‘Log to History List’ and enter ‘File converted to PDF Format’.
     
  4. Insert a new action named ‘Update List Item’ and click this list. We are now going to automatically mark the converted PDF file as approved.
     
    • From the ‘List’ dropdown select ‘Important Documents’.
       
    • Click the ‘Add’ button and set the field to ‘Approval Status’ and the value to ‘Approved’. Click OK. Please note that things have changed in SharePoint 2010, it is no longer possible to set the value of the ‘Approved’ field. For details and a workaround see this thread on our forums.
       
    • In the ‘Find the List Item’ area set the Field to ‘Important Documents:ID’.
       
    • Click the fx button next to ‘Value’, specify ‘Workflow Data’ as the Source and set the Field to ‘Variable: List Item ID’. Click OK.
       
    • Click ‘OK’ again to return to the Workflow Designer. It should look like the image below.

workflow2

Click the ‘Finish’ button to activate the workflow.

 

Testing the work flow
 

Testing the workflow is simple: create or upload an MS-Word file to the ‘Confidential Proposals’ folder, from the context menu select ‘Approve / Reject’ and approve the file.

This will automatically start the workflow and after a few seconds the Workflow status should change to ‘Completed’ as shown in the screenshot below.

workflow3

 

Once the workflow has completed, you should see the PDF version of the document in the ‘Approved PDF Files’ folder.

workflow4


If an error occurs during the execution of the workflow then have a look at the following:

  1. Check the messages on the workflow status screen.
     
  2. Look in the Windows Event log.
     
  3. Look in the SharePoint trace log.

.

Labels: , ,

18 Comments:

  • I'll take a look at it if you would like me to.

    By Anonymous Jonathan Gardner, At 23 April, 2009 14:35  

  • Thanks Jonathan, please send your email address to support@muhimbi.com and we'll send you the beta version.

    By Blogger Jeroen Ritmeijer, At 23 April, 2009 14:53  

  • Just wondering if it is exposed outside of SPD ? We use Nintex Workflow and would very much like this feature.. If I was able to access it via a webservice,,, that would be awesome.. or there is an SDK available for nintex workflow and a custom action could be created..

    By Anonymous Dan, At 10 November, 2009 21:24  

  • Hi Dan,

    We have customers who use it from Nintex Workflow. I am not the Nintex expert, but I think they call an SPD workflow from the Nintex Workflow.

    Nintex also has an SDK that makes it quite easy to make a Custom Action for their system. If you have a look at the following blogpost then you can see how to access our functionality from your own .net application:

    http://www.muhimbi.com/blog/2009/10/using-pdf-converter-for-sharepoint-from.html

    The next vesion of the PDF Converter, which supports all Office formats, is currently in beta. It comes with a web services interface to allow it to be called from external applications.

    By Blogger Muhimbi, At 11 November, 2009 09:43  

  • Hi,

    When do you expect the current beta to be released? I would also like to integrate Nintex Workflow with your product and can definitely se potential while using a web service.

    Regards,

    Will.

    By Anonymous Will, At 05 January, 2010 05:03  

  • Hi Will,

    The product has been out of beta for a long time. You can interact with it from Nintex by invoking an SPD Workflow I understand. You can also invoke it via a web service call or directly from your own code. For details see the list of 'Blog Highlights' on the left hand side of http://muhimbi.com/Products/PDF-Converter-for-SharePoint.aspx.

    We have had someone else from your company trying to contact us, but he didn't leave any contact details, so please drop a line to support@muhimbi.com if you need to get in contact.

    By Blogger Muhimbi, At 05 January, 2010 09:23  

  • After the item is converted, can you have it email the item to someone. Does this export data from a list as well? Is it possible to combine both the content from a list and attach the documents as well?

    By Anonymous Anthony, At 02 December, 2010 20:18  

  • Hi Anthony,

    You can do whatever you like, see the following posts:

    • http://blog.muhimbi.com/2009/11/automatically-convert-files-to-pdf.html
    • http://blog.muhimbi.com/2009/09/inserting-sharepoint-list-data-into-pdf.html
    • http://blog.muhimbi.com/2010/01/configure-pdf-security-from-sharepoint.html
    • http://blog.muhimbi.com/2010/10/watermarking-features-of-muhimbi-pdf.html
    • http://blog.muhimbi.com/2009/12/send-rich-emails-with-attachments-from.html

    Hope this helps. Feel free to contact us directly using the ‘Contact Us’ feature at the top of each page on our website.

    By Blogger Muhimbi, At 02 December, 2010 20:30  

  • Can you handle business rules in infopath form. For instance if one option box is checked, only form section related to that option box is displayed. What happens if I have multiple overlapped form sections?

    By Anonymous Anonymous, At 03 March, 2011 20:17  

  • Yes, and we also support PDF Conversion specific views, see http://blog.muhimbi.com/2010/08/controlling-which-views-to-export-to.html.

    Give it a try, a free download is available from the product page. No registration required.

    By Blogger Muhimbi, At 04 March, 2011 08:41  

  • Hello,
    Very good converter !
    With SharePoint designer workflow :
    - start manually -> it's ok
    - but with workflow starts automatically when an item is created -> workflow doesn't start ....

    (There is no error in the windows event viewer)

    Any idea ?
    Thanks.

    By Anonymous Anonymous, At 15 June, 2011 17:30  

  • With regards to the workflow not triggering, you have either not specified it to autostart or you are logged in as the system account (see http://sharepoint.stackexchange.com/questions/5402/workflow-not-triggering-on-new-item-in-e-mail-enabled-list)

    Feel free to contact us directly using the 'contact us' link at the top right of the page.

    By Blogger Muhimbi, At 15 June, 2011 17:33  

  • Can you have PDF conversion as part of records declaration workflow?

    By Blogger Half, At 11 January, 2013 10:48  

  • Hi Half,

    You can use our workflow components to add a workflow to anything in SharePoint using SharePoint Designer, Nintex Workflow or Visual Studio. If you have any specific questions then please contact support@muhimbi.com.

    By Blogger Muhimbi, At 11 January, 2013 11:40  

  • Hi,
    Can you use this with SharePoint Online?

    Thanks,
    Mark

    By Anonymous Anonymous, At 19 April, 2013 14:12  

  • Hi Mark,

    Unfortunately SharePoint online's extensibility is limited and therefore, like most other 3rd party products, not supported by our software.

    By Blogger Muhimbi, At 19 April, 2013 14:18  

  • Do you have to have Nintex Workflow to do this? I don't see an "Convert to PDF' in the SharePoint designer actions. I assume that will be added if we purchase and instll this? Is that correct?

    By Anonymous Anonymous, At 27 March, 2014 16:25  

  • You don't need Nintex Workflow or a fully licensed copy for this. If, after installation of our software, you do not see any new PDF related workflow actions in SharePoint Designer then please contact support@muhimbi.com. They are always happy to help.

    By Blogger Muhimbi, At 27 March, 2014 16:27  

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