Creating Colored QR Codes During a Data Merge
Since the release of InDesign CC, it has been possible to create QR codes directly in InDesign by choosing Object > Generate QR Code, with or without a frame selected. In the dialog box, you can insert the data that the QR code will represent (the Type), and choose the color of the QR code.
In more recent versions, the Data Merge feature has been improved to import variable QR codes based on data in the source file. More information on how to create QR codes for Data Merge can be found here.
However, there is a major limitation with this feature: the QR codes generated during a data merge could only have a black fill, and there was no way to change the color during the merge.
There are several potential solutions to this issue, such as:
- Merge to an InDesign file and post-process the QR codes by changing the colors manually in each code. A solution that will work but take time.
- A dedicated plug-in that can handle colored QR codes.
But it turns out, the answer to creating colored QR codes for a print project is actually quite simple: use a transparency mask to make the QR code show through the desired color, similar to the technique shown in this article.
This technique that requires you use three square frames of the same size within a data merge that has at least one QR code field:
- The frame at the bottom of the stacking order is the desired color of the Fill of the QR code.
- The frame in the middle of the stacking order is the desired color of the Background of the QR code
- The frame at the top of the stacking order is the variable QR code itself.
Select the top frame that contains the variable QR code and from the Effects panel, set the Object Opacity to zero. This should make the frame become clear.
Align the centers of the middle and top frame together so that they overlap, and group them.
With the group selected, click the Knockout Group button of the Effects panel.
Lastly, align the centers of the bottom frame and the selected group, but do NOT group them.
At this point, you might think this trick hasn’t worked. However, go to the Separations panel and from the View dropdown, select Separations.
Voila, the technique is complete! The only thing left to do is toggle through the records in the Data Merge preview to confirm that the QR Codes are changing but the colors here remain the same between each record.
This technique also allows a type of fill that would not normally work for static QR codes, namely gradients. Instead of using a solid red fill on the bottom as per the previous example, a linear or radial gradient can be used.