is now part of CreativePro.com!

Creating Colored QR Codes During a Data Merge

6

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 workaround that I produced a javascript for along with a video explanation. However, if the database changes, the procedure needs to be re-run.
  • 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.

Bonus Tip:

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.

A prepress operator and graphic designer for a South Australian commercial printer, with close to 20 years of experience in the trade. He is also a regular contributor to this site and InDesign Magazine, and hosts his own prepress blog "Colecandoo".
  • Karsten Winther Jensen says:

    Choose some solid color and make sure that your device can actually recognise the qr code. You don’t need to make a print for testing. You can test from screen and if that works you art should be safe.

    Good article.
    Thanks Colin

  • Loic Aigon says:

    @Colin, what if the front frame would consist of a text frame with some paragraph style using grep styles and character styles set to use underline option. That way you could think of using dynamic color for the QRcode as you already demonstrated in many of your works. Am I wrong ?

    • Uwe Laubender says:

      Hi Loic,
      while reading this article I instantly thought abbout exactly this.

      Character styles with underlining with different colors. Triggered by GREP Styles with something like a color code: 1 for color 1 that comes with character style 1, 2 for color 2 that comes with character style 2 and so on…

      Data:
      0 1
      0 2

      GREP Styles:
      ^0 1$ > CharacterStyle-1
      ^0 2$ > CharacterStyle-2

      Formatting: Fully Justified.

      Regards,
      Uwe

      • @Uwe and Loic
        You have read my mind. This will be covered in future articles, but for now I just wanted to start off very simply with the use of an old-but-gold trick to change the color of variable QR Codes. Stay tuned, more will follow on this…

  • Hello Colin,

    Thank you for sharing this wonderful article on Creating Colored QR Codes During a Data Merge. It’s one of the best articles I have read in recent times.

  • vinutha says:

    the Data Merge feature has been improved to import variable QR codes based on data in the source file.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.

  • >