Data Merge QR Codes Explained
Data Merge QR Codes were a feature added to InDesign CC 2014. The instructions provided by Adobe for creating variable QR codes in InDesign may provide a false sense of security for most end-users. Adobe’s help site shows the QR code feature as “Enhanced Data Merge” towards the end of the page, and spells out the specifics of how the code must be written.
This said, it means that QR codes are not applied the way most users would imagine. For example, if someone wanted an email address to appear as the QR code so that the result (once scanned) will send an email to a given address, it means they cannot use a field already in a database and apply the QR code field from the Data Merge panel. Instead, a new field must be created specifically for the records that are to appear as QR codes.
Here are the essentials:
- The record that contains the information to become a QR code must be a field of its own
- The field header must have a hashtag at the start of the field name (e.g. #code)
- The codes will always display as black, though the background color can be changed.
- The QR codes have to be written containing any necessary metadata specific for their purpose.
This is where most InDesign users may encounter problems, especially if they are unfamiliar with QR code metadata, and how to easily apply this metadata to existing information in a database. Before tackling this issue, it is important to understand what is going on. Put simply, at the start of the QR code, there is information that tells the QR code reader what kind of data is about to be parsed, for example:
- SMSTO: send an SMS;
- URL: load a web page in a browser;
- TEL: call a given telephone number
It is also possible to include more information so that the QR code reader can provide further information for the code being scanned, such as names and addresses for “virtual card” information.
The Adobe Help page lists five different ways that the metadata can be written, such as Plain Text, Web Hyperlink, Text Message, Email, or Business Card. However, any metadata available for QR codes can be used, provided the metadata is written correctly. This allows the QR codes to contain information such as Geo-location coordinates. A list of ways of writing the metadata can be found on this page.
It is also of note that there are several ways to write the code for contact information. While the Adobe Help page suggests using the VCARD method, the MECARD and BUSCARD methods also work.
As for the code to send an email, I initially had difficulty following the instructions on the Adobe Help site, so I used an alternative coding method – the W3C standard (rather than the MATMSG standard as suggested in Adobe’s Help). Eventually, I discovered that the code on Adobe’s Help page is incorrect:
It is missing a character and contains unnecessary data. It should read:
The problem – the semi-colon was missing before the SUB, and the \n (new line instruction) is not necessary given that the semi-colons indicate the end of a line.
So, the question is how to use a database that has no dedicated QR code field so that InDesign can apply variable QR codes. Assuming the data is supplied as a Microsoft Excel spreadsheet, the answer lies in a formula type called Concatenation.
For example, take the following cards that need a QR code to email the consultant. The Excel file only contains the email address of the consultant, so a new field that will become the syntax for the QR code must be created. In this example it will be called #Qremail.
To accomplish this task, use the concatenate function of Excel. This function is used when entries in several cell must appear together in the same cell.
In the first empty row of the newly created field, use the formula builder to create the following formula that includes the concatenate function.
This will give the following result based on the email entry in the first row:
MATMSG:TO:[email protected];SUB:Hello Adam;BODY:;;
Entering the syntax in this fashion will yield an email that is sent to the email address, and contains a subject line:
Hello First (where First = the first name of each person in the database above)
This example uses an email address, but it also demonstrates the power of the Concatenate function. If you’re creating QR codes for virtual cards, I would definitely recommend using a similar procedure utilizing the Concatenate function.
This formula can now be copied for the rest of the spreadsheet, and the spreadsheet saved as a tab delimited text file (CSV is possible, but the tab delimited text file format is my preference when dealing with complicated punctuation, as the database is less likely to create unexpected side effects thanks to a wayward comma or quotation mark). Close the newly saved .txt file before returning to InDesign.
Once back in InDesign, select the data source from the Data Merge panel and choose the newly saved .txt file. Once updated, the panel will indicate what fields will yield QR code information with a QR code icon. Once a QR code placeholder has been placed into an InDesign file, it displays with a blue dotted line.
The file can then be merged to a new file or PDF for output with the QR codes displaying correctly. Try scanning the sample below!