How to create Word and PDF documents from JotForm in Microsoft Flow and Azure Logic Apps

Let's suppose you want to automate the generation of documents in your company. For example, applications, orders, invoices, etc. By going through this article you will learn how to create a DOCX document from a template and convert it to PDF on a JotForm submission with help of Plumsail Documents in Microsoft Flow and Azure Logic Apps.

JotForm is an online form builder that allows you to create forms with a drag and drop creation tool and an option to encrypt user data.

In our example, we will collect data from a JotForm, apply the data to our template and generate a new PDF document.

Description

Our source and result documents have to be stored somewhere. In this example, we store our documents in OneDrive.

Microsoft Flow has a lot of connectors for different systems. Here are just a few of them:

  • SharePoint
  • Salesforce
  • Box
  • OneDrive
  • Google Drive
  • Dropbox
  • SFTP
  • File System

You can store your source file anywhere.

We need to create a Microsoft Flow that will be triggered by a JotForm submission. The flow will get the template from OneDrive, apply data from a submitted JotForm to this template, convert the generated document to PDF and save it to OneDrive. This is how our complete flow looks like:

Creating Word and PDF documents from JotForms flow

We prepared a Microsoft Flow Template that you can use right away. It includes all the steps described in this article. To use the template just go to MS Flow, click Templates in the left navigation, type Create Word and PDF documents from JotForm and hit Enter. You will see the template. You may use it as-is or customize it to, for example, store documents in another storage platform.

Microsoft Flow Template Create Word and PDF documents from JotForm

Description of Microsoft Flow Actions

Please find the description of all the actions from the flow below.

Form is submitted

We've already created a JotForm and we will use data from its submission in our flow. If you haven't created a form yet, you can learn how to do it here.

Below is a screenshot of our form:

JotForm

To start the flow on form submission we search for JotForm in MS Flow and add JotForm - When a response is submitted trigger.

If this is your first Flow with JotForm, at this point you'll need to Sign into JotForm Account from MS Flow, so you can start using your forms inside your flows.

You'll need to pick the form you want to track in the dropdown.

Get file content

This action gets file content of the specified file from OneDrive. We use this action to read a .DOCX template. You can use any other connector to get files from your system.

Below is our template. You may download it here.

Template

Plumsail Word DOCX templates use a different approach than most other templating solutions. It uses a minimal amount of syntax to make your work done.

In short, templating engine thinks that everything between these {{ }} brackets is variables where it will write the data you specified in Template data.

Read this article to get familiar with the templating engine.

Create DOCX Document from Template

This is the action from Plumasail Documents connector. This action is suitable for creating documents from a template. You can find more information about the action by visiting this page.

There are two parameters:

1. Document content

In the first parameter Document content, we specified the output of the previous action as a template.

2. Template data

In the second parameter Template data, we specified data to apply to the template in JSON format:

Template data in JSON format

This object contains information from our form. We selected the content from the output of JotForm  -  When a new entry is created action in the menu on the right:

Menu on the right

Convert DOCX to PDF

This is also an action from Plumsail Documents connector.

Just put DOCX file content from the output of the previous action and receive PDF file content as an output from this action.

You can find more information about this action here.

Create file

Once the result document is generated, we need to store the PDF file somewhere. In our example, we use Create file action from OneDrive connector to store the document in OneDrive.

You can use any other connector to store documents in your system.

This is how the final document will look in our case:

Final document

Conclusion

Now you should have an idea of how to use Create DOCX Document from Template and Convert DOCX to PDF actions from Plumsail Documents for Microsoft Flow to automatically create documents on a JotForm submission. If you haven't used our actions yet, registering an account would be the first step. It is quite easy to get started.