Create PDF documents from DOCX template

This article demonstrates how to generate PDF documents from a DOCX template with the help of Plumsail Documents processes. We will use a DOCX document as a template. And with the help of Processes, we will receive the result file in PDF format.

The Processes are a user-friendly intuitive interface for creating documents from templates, converting and delivering them to different systems for further management.

In this article, we will generate a PDF invoice, and this is how the final document will look:

create PDF from DOCX template

Let’s go through the following steps and create a process for generating PDFs from a DOCX template.

Configure Process

First, login or create your Plumsail account.

Create new process

Click the Add Process button and choose either to start from a template or from blank. We’ll start from blank.

add process button

Give your process a name and select DOCX for the template type.

create PDF from DOCX template

Configure template

Next Configure template step includes two sections:

  • Editor;

  • Settings.

In Editor, you can either create a template from scratch or upload a pre-built one. You can download and test the template used in this example. Additionally, it is possible to modify the uploaded template directly in the Editor step.

upload template file

Templating syntax

When designing your own template from scratch, start by reviewing the templating language used in Plumsail Documents. Plumsail Word DOCX templates use a different approach compared to other templating solutions, utilizing minimal syntax to get the job done.

To learn more about the templating engine, check out this documentation article.

Essentially, the templating engine interprets everything between the curly {{ }} brackets as a variable, dynamically applying your specified data. In our case, the most siple tokens would be {{invoiceNumber}} and {{date}}. They let the engine know that we want to render the invoice number and its date.

However, we can also implement more complex scenarios. In our template, we reference properties within a collection of products using nested tokens with a dot operator:

  • The {{product.name}}, {{product.price}} tokens retrieve the name and price properties of the product.

The templating engine is smart enough to identify which content needs to be duplicated. It iterates through all objects in the array, rendering each one and automatically adding the necessary rows.

tables in DOCX templates

You can learn more about table rendering in the tables section of the documentation.

Test template

To check how the final document will look, click on the Test template button. A dialog window will pop up where you can fill in the auto-generated testing form. Form fields are created based on the tokens from your document template. You can adjust the look of the testing form by changing token types.

create docx from template

Once the template is ready and you’re satisfied with the results, click Save & Next to proceed to the Settings step.

In this step, you can set the Template mode to testing or production, customize the Output file name with tokens from the template and select the Output type. We will select PDF.

configure DOCX2PDF template

Template mode

It is set to Testing by default. This means you won’t be charged for process runs, but the resulting documents will have a Plumsail watermark. Switch to Production to remove the watermark.

Output filename

You can add tokens to personalize the Output Filename. They function the same way as they do in the template. For example, by adding {{invoiceNumber}} token, the generated PDF document will be named Invoice 432.

Output type

By default, the file format matches that of your template, which in our example is DOCX. We have changed it to PDF to generate PDF documents from the DOCX template.

Test template

You can also test the template in the Settings step. The testing process is identical to the one described above.

Add Delivery

The next step is Delivery. In our example, we’ll store the generated PDF files in OneDrive, but there are many other built-in delivery options available, such as Dropbox, DocuSign, SharePoint, email, and more.

First, you will be prompted to connect your OneDrive account to Plumsail. Then, create a folder where the generated PDF documents will be saved. Tokens can be used here as well.

You can add as many deliveries as needed.

set up onedrive delivery

Start Process

Everything is now ready for you to begin generating PDF documents from a DOCX template. In the Start process step you have several options to trigger document generation, which are listed below.

start process to create PDF from a Word template

You can start the process :

Use Power Automate Flow, Zapier and Make to integrate the Documents Process with other apps. This allows you to collect data from one application and pass it into the process to populate a DOCX template and generate a PDF document. You can use data from various web forms, CRM systems, SharePoint lists, and thousands of other web applications to complete your DOCX template.

Hint

You can create a fillable PDF and use it as a template for generating PDF documents with Plumsail Processes. This file format is also supported.