All Collections
Steps
Writer Steps
Word Merge to PDF Writer Step
Word Merge to PDF Writer Step

The Word Merge to PDF Writer step is used to merge values to fields from any source to an existing Word template & create a new PDF file.

Praise Magidi avatar
Written by Praise Magidi
Updated over a week ago

Setting up to use a Word Merge to PDF Writer step

There are two important flows that need to be created before adding and using a Word Merge to PDF Writer step in a flow. The following are the flows that needs to be created:

Flow 1: Load Word Merge Template

This flow is used to load a Word Merge template that will be used to assign values to the fields in the template. The image below shows an example of a Word document that contains merge tags as highlighted.

Illustrated below is a flow that is used to load the Word merge template file. The Group mapper step groups the records using a specified set of keys and returns the results as an array. The Calculator step creates a base64 string of the file. The Buffer destination step is used to store the base64 string.

The image below shows the input parameter that has been created for this flow. To create an input parameter, click the step shown in the image below.

The Name and Type are inputted as shown in the below image. Click on the Required checkbox to make it a required parameter. Save the parameter by clicking the green tick on the far right and then on the Save button.

The image below shows the code that is used in the calculator step to create the base64 string.

Flow 2: Test Merge Fields

This flow is used to test the merge template to see if the system is picking up the merge fields from the template. Illustrated below are the steps that are used in the flow. The Buffer Lookup is used to select the template from the buffer. The Buffer Lookup step is used to locate the template path.

The image below shows the Buffer Lookup step configuration where the lookup is based on the name of the file that is in the buffer and from the name that is being inputted as a parameter (image 2).

The Word Merge Fields Lookup mapper step is illustrated in the image below with the template path.

The image below shows the output of the Word Merge Fields Lookup Step which shows that the template fields are being referenced.

Flow 3: Flow Using the Word Merge to PDF Writer Step

Illustrated in the below image is an example of a flow. The Record Generator is used as a source step. A Super Mapper maps the fields. A Buffer Lookup step references the merge template field name to use (please refer to flow 2 for the configuration used in the Buffer Lookup step). The Calculator step is used to return the mapped template fields. The Word Merge to PDF Writer Step creates the PDF file which can be downloaded by using the Run File destination step.

The image below shows the input parameter that has been created for this flow. The Name and Type are inputted as shown in the below page. Click on the Required checkbox to make it a required parameter. Save the parameter by clicking the green tick on the far right and then clicking on the Save button.

The Record Generator source step contains sample data shown in the image below. These are the fields where values will be merged to create the PDF document.

The source fields (fields on the left) and destination fields (fields on the right) are being mapped in the Super Mapper step as illustrated below.

A Calculator step is added after the Super Mapper step to return the mapped fields and the base64 Word template which is shown in the below image.

The output of the Calculator step is shown in the image below.

Adding the Word Merge to PDF Writer Step

To add the Word Merge to PDF Writer in a flow, follow the below instructions:

1. Click on the highlighted plus icon as shown in the below image.

2. The below page will appear. Select or search for a Writer step to pull out the source data. Click on the Writer tab and select Word Merge to PDF as shown in the image below.

Configuring a Word Merge to PDF Writer Step

Illustrated in the below image is the configuration that is available in the Word Merge to PDF step.

Update Table of Contents checkbox – Forces a refresh of the Table of Contents following a merge.

Update Calculated Fields checkbox – Forces a refresh of Word calculated fields following a merge.

Clear Unmerged Fields checkbox – Clears unmerged fields following a merge.

Remove Empty Groups checkbox – Removes groups that have empty objects specified in the input mappings following a merge.

Remove Empty Paragraphs checkbox – Removes empty paragraphs following a merge.

Remove Empty Pages checkbox – Removes empty pages following a merge.

The Run File destination step is shown below. The File Type has been selected as Pdf.

Using a Word Merge to PDF Writer Step

Once the configuration is saved on the Word Merge to PDF Writer step, follow the instructions below to execute the Flow 3:

1. Click the Execute Flow button shown in the image below:

2. Highlighted in the image below is the Template filename that was sent to the Buffer destination step in Flow 1 which is inputted in the Template parameter in Flow 3. Click the Create Run button to execute the run.

3. Click the download button in the Run File step to download the output file which is the created PDF document after the run has finished processing.

The image below shows the PDF file that was created with the values assigned to the fields.

Did this answer your question?