Showing results for 
Search instead for 
Did you mean: 

Having a working and published document using Convert document action

Automation Master
Automation Master
5 4 2,469

Converting a Word Document to PDF

I am often asked about seperation of permissions with working and published documents, and a way of doing this nicely with workflow is to use the Convert document action.  We have many instances within the business where a small team have access to a "working" document library but push finalised and approved documents to an open document library for all authenticated users to consume.  We will use this scenario for the working example below.  We will have our "working" document library called Read Write PDF and have our "published" document library called Shared Documents.  All users will have access to read the content of Shared Documents but only team members will have access to Read Write PDF.

  • Navigate to the Read Write PDF document library and select Library tab in the ribbon, Workflow Settings and Create a Workflow in Nintex Workflow.
  • Select the blank template.
  • We need to change the file name of the document we are working on to remove the .docx extension and replace it with .pdf (as when we configure the Convert document action later we will need the full name including extension).  We can do this by adding a Regular expression action to the workflow.
  • The Regular expression action requires a variable to put the output value into, so we need to create a variable.
  • Drag the Regular expression action to the first design node on the workflow and double click to open the configuration options.
  • To create a variable for the output of this action, select Variables in the ribbon of the Regular expression action to open up the Workflow Variables window.  Select New in the ribbon and create a variable as below:


  • Select Save and then close the Workflow Variables window to return to the configuration of the Regular expression action.
  • Configure it as follows:


  • So now we have the name and extension of our newly created pdf, we need to actually convert the document into a PDF and place it into the Shared Documents library.  Add the Convert document action to the next design node on the workflow and double click it to open the configuration settings.
  • Configure the item as follows, ensuring that the Output URL is https://xxx/sites/busitc/Nintex/Shared%20Documents/{vTextFileName} - replacing the bold area with the variable created earlier by using the insert reference book and selecting Workflow Variables.


In this example I have decided to catch the errors (if any occur) in the above action and store the occurrence and text in variables called vBoolError (did the error occur) and vTextError (what was the error).

I will use a Run if logic action to log the details of the error to the history list if an error occurred.

  • Add the Run if action to the next design node on the workflow and double click it to open the configuration window.


The idea behind this is that we want to check if our newly created variable vBoolError is equal to yes, which would imply that the Convert document action errored.

The configuration above checks if the variable vBoolError = yes

Inside the Run if action, I use Log in history list action to log the reason for the error in the message body by referencing the variable vTextError


Add any additional actions as required to your workflow.  Change the start up options as required (in this example we were happy with a manual start but this could be done after multiple approvals for example) and Publish.

Nintex Newbie

Cassy Freeman, will this work if the name of the document has a space in it?  It's my understanding you need to have the %20 for any spaces in the document name for the conversion to work.

Automation Master
Automation Master

I believe you're right Brendan Murphy​ so I will add to this later to ensure no spaces in the document name.  Thanks for highlighting!

Nintex Newbie

Cassy Freeman‌, I have a question ;)

I made a similar Workflow to your one. We have a library and after a draft is published, i copy the published document to a "Published Document" library. There is a workflow that runs on item created. This workflow converts the docx to a pdf and after converting it deletes the docx file. But my Problem is...when the pdf file is created...the workflow starts immediatly (because a new file is created). This Workflow Ends with an error. On the start i check if the document Ends with a docx. And only than it should run into the Body with the conversion. In the "Convert2PDF" Column a Workflow error occurs, but if i check the workflow history from ne newly created pdf, is empty. Do you have a hint?

Thank you!

Automation Master
Automation Master

Hi david

happy to have a look at this with you but you will get more visibility and help if you post this as a question in ‌. If you reference the question in the comments on this blog post it will close the circle. Let me know so that I can have a look at your screenshots