Back to How-Tos

QR Codes in Designer

In this how-to we'll be covering the use of QR Codes in Connect Designer, more specifically how to obtain the right data for specific types of QR Codes.

QR is a 2-dimentional matrix of dots that may contain a whole lot of data. It's very popular in ads, as most smartphones nowadays have a barcode scanner that supports barcodes and will react appropriately depending on the data: It will propose opening URLs, adding VCard data to the contact list, etc.

But a QR code is essentially just a string of information: the only thing that distinguishes a "vCard" from an "MMS" or "Geolocation", is how this data is formatted.

Let's take a look at one of the most popular formats, the vCard, and how you can introduce this data into your QR code, for printing on any document. Note that this works in all available contexts, as the QR code is a generated image file.

Adding QR Code to your document

First, we need to add the QR Code object to the document. From the menu, select Insert, Barcode, QR Code.

In the Insert QR dialog, choose the top options you prefer, making sure not to choose "Absolute on body" if you're in an Email context.

While it would be technically possible to add the QRCode data using the regular Text wizard, it's cleaner and more understandable using a script. Click on Expand to show the default script, remove all the code that is there and replace it with the following, which is a basic vCard:

var vcard = 'BEGIN:VCARD\n'
+ 'VERSION:4.0\n'
+ 'N:@last@;@first@;;;\n'
+ 'ORG:@company@\n'
+ 'EMAIL;TYPE=work:@email@\n'
+ 'TEL;VALUE=uri;TYPE="work":@phone@\n'
+ 'TEL;VALUE=uri;TYPE="cell":@mobile@\n'

vcard = vcard.replace("@first@", record.fields.first_name);
vcard = vcard.replace("@last@", record.fields.last_name);
vcard = vcard.replace("@company@", record.fields.company_name);
vcard = vcard.replace("@email@",;
vcard = vcard.replace("@phone@", record.fields.phone1);
vcard = vcard.replace("@mobile@", record.fields.phone2);


This is not a universal script, however. The vcard.replace() lines are indicating that, within the vCard string, we need to replace each placeholder with the actual record data. You will need to change the record.fields.field_name sections at the end of each of those lines with the appropriate field name from your data.

Note that in versions of Connect up to 1.4, you will need to open the barcode properties once (Right-click, QR Code) and click OK for this technique to work, due to a minor issue. Otherwise, you are good to go!

The vCard here is also a "basic" or "partial" one: the vCard specs support a lot more than only these fields. For more information on the vCard 4.0 specifications please see this wikipedia page on vCard.

Other formats

There are of course a lot more formats supported by QR Codes, ranging from geolocation to youtube video links. For more information on these formats (which depends on the reader and the device, however), check out ZXing barcode contents.