Using bar codes with merge templates

Happy New Year! It seems like enough of 2019 has passed that a new blog post is in order.

The idea of merge templates came to FileHold in version 15.2 as a part of the convert to PDF feature inside workflow. In version 16.0 the idea was extended to use them with Assemble for flexible document assembly.

The basic premise of a merge template is that there is a file containing special embedded tags that can be automatically expanded with meta information known to the document management system about the document. This meta information can include the values of user defined metadata fields and system information such a document's approval date and signoff sheet.

The merge templates can be created in a rich publishing environment such as Microsoft Word® so there are many possibilities for the template designer to control the look of the output. This includes the size, position, and typeface of the text that will become part of the final document.

There are many use cases for incorporating barcodes into documents, but the one we will consider here is a document control scenario. In this scenario the FileHold document management system is the single source of truth for documents at the company. However, as a part of operational processes, documents get printed and move throughout the plant. There is always the question of whether or not the printed document is the latest version or how to get the latest version of the document.

Barcode scanners can easily and inexpensively be added to computer workstations. If the unique document identifier in the document management system could be included with the printed document as a barcode it would be very easy to find the source document in the system. A public quick search could be configured for users that expects the document id. It would be a simple matter for a user to scan the barcoded document id on their printed document to find the most current approved version of the document in FileHold.

The key to the process is to combine a merge template containing the document id with the workflow approval template used to approve the documents and use a barcode font for the document id in the merge template. Barcode fonts are readily available for purchase or free such as the Code 39 font created by Matthew Welch. In the following example we will include the document name, document id, effective date, and signoff sheet for the document. The effective date is used instead of the approval date as in this use case the documents are only effective two weeks after they have been approved.

In the example screenshot you can see the following merge tags. I will assume the reader can investigate the details for Assemble and Convert to PDF in the knowledgebase.

Merge tag



Simply the name of the document in FileHold.


The internal document id that makes every document in FileHold unique. This field is used in both a human readable form and barcode form in the merge template. The formatting code “0000000” is to ensure the number will always be exactly 7 digits long. This provides some visual consistency in both the text and barcode versions. To create a valid barcode, the tag is enclosed in asterisk (*) characters like "*[[sys|filehold-id|0000000]*"


There is no such field as effective date in FileHold, but for this use case example I will define it as two weeks after the approval date. The “DateOffset” function is used inside the tag to add 14 days to the approval date.


A clean list of person names, titles, and approval dates corresponding to the audit log inside of FileHold.

A red border has been included around the document identification section below to make it clear how a table was used to keep the formatting clean and consistent despite the variable fonts and field values. The actual values will replace the tags when the activity is approved, then the formatting will be applied including the barcode font.

In the example some of the tag appears as barcode characters and some appears as regular text. This is because we are using the standard Code 39 format which only encodes numbers, capital letters, and a few special characters. An asterisk character is included immediately before and immediately after the document id tag as required by the Code 39 specification. The Code 39 symbology was chosen for this example as it is one of the easiest to use as a barcode font.

Merge tag template example

When the template is complete it should be added to FileHold and included in the merge template list as per the documentation for convert to PDF and workflow. A workflow template should be created to include the merge template in one of the activities. Since a signoff sheet is a part of this template, this will typically be added to the final approval activity in the workflow template.

All that is left is to initiate the workflow template on a document and a new PDF version of the document will be created with our merge template content as the last page including the barcode document id.

Merge tag output example

You can download the merge template used in this example in Microsoft Word® format.

Russ Beinder

Russ Beinder is the Chief Technology Officer at FileHold. He is an entrepreneur, a seasoned business analyst, computer technologist and a certified Project Management Professional (PMP). For over 35 years he has used computer technology to help organizations solve business problems.