# QR Code

EasyCatalog includes support for all of the QR Code types supported by InDesign, although some types require the use of a custom field to provide the content of the QR Code.

EasyCatalog version 18 and newer includes support for QR Codes as a [barcode](https://easycatalog.nousmedis.com/setting-up-your-data/field-options/available-field-options/the-format-pane/barcode) type in `Field Options`; for previous versions, QR codes can be generated using LUA script attached to an image frame.

### URL/Hyperlink QR Codes

If one of your fields contains a URL, it can be output as a QR code:

{% stepper %}
{% step %}
Edit the `Field Options` for the field (use the `Field Options` menu from the data panel’s pop-out menu)
{% endstep %}

{% step %}
Click on `Format` on the left of the dialog
{% endstep %}

{% step %}
Change the field’s type to be `Barcode`
{% endstep %}

{% step %}
Change the type of barcode to be `QR Code`
{% endstep %}

{% step %}
You can also specify the name of a swatch that will be used to generate the QR code.
{% endstep %}
{% endstepper %}

The field can now be inserted into an image box, and the QR code will be generated.

### Text QR Codes

If you need to output text as a QR Code, follow the instructions above for URL/Hyperlink QR Codes.

### Email QR Codes

Email QR codes require three fields: `email address`, `subject` and `email body`. To generate an e-mail QR code, you must first create a custom field that takes these three fields and generates a string suitable for output as a QR code:

{% stepper %}
{% step %}
Create a new custom field

Right click in the panel and use the `New Custom Field` option, or use the `New Custom Field` option from the `Field Options` menu
{% endstep %}

{% step %}
Give the new field a name at the top of the dialog

E.g. `email QR Code`
{% endstep %}

{% step %}
Use the `QRCODEENCODEEMAIL` custom field command

For example, if you have three fields in your data containing the `email` address, `subject` line and `email-body` contents you would use:

```
QRCODEENCODEEMAIL(FIELDSTR(email), FIELDSTR(subject), FIELDSTR(email-body))
```

{% endstep %}

{% step %}
Click on `Format` on the left of the dialog
{% endstep %}

{% step %}
Change the field’s type to be `Barcode`
{% endstep %}

{% step %}
Change the type of barcode to be `QR Code`
{% endstep %}
{% endstepper %}

The field can now be inserted into an image box, and the QR code will be generated.

### SMS QR Codes

SMS QR codes require two fields: telephone number and message body. To generate an SMS QR code, you must first create a custom field that takes these two fields and generates a string suitable for output as a QR code:

{% stepper %}
{% step %}
Create a new custom field

Right click in the panel and use the N`ew Custom Field` option, or use the `New Custom Field` option from the `Field Options` menu
{% endstep %}

{% step %}
Give the new field a name at the top of the dialog

e.g. “SMS QR Code”
{% endstep %}

{% step %}
Use the `QRCODEENCODESMS` custom field command

For example, if you have two fields in your data containing `telephone` number and text `message` body you would use:

```
QRCODEENCODESMS(FIELDSTR('telephone'),FIELDSTR('message'))
```

{% endstep %}

{% step %}
Click on `Format` on the left of the dialog

{% endstep %}

{% step %}
Change the field’s type to be `Barcode`
{% endstep %}

{% step %}
Change the type of barcode to be `QR Code`
{% endstep %}
{% endstepper %}

The field can now be inserted into an image box, and the QR code will be generated.

### VCard QR Codes

QR codes can also be generated that represent a virtual business card (VCard).

{% stepper %}
{% step %}
Create a new custom field

Right click in the panel and use the “New Custom Field” option, or use the “New Custom Field” option from the Field Options menu
{% endstep %}

{% step %}
Give the new field a name at the top of the dialog

e.g. “VCard QR Code”
{% endstep %}

{% step %}
The `QRCODEENCODEVCARD` custom field command accepts the following parameters **in this order**, although only First and Last Name are mandatory:

* First name
* Last name
* Address
* City
* State
* Zip
* Country
* Telephone
* Cell phone
* Email,
* Website,
* Job title,
* Organization
  {% endstep %}

{% step %}
Fields that are not required should be left empty.

For example, if you have fields containing the first and last name, address, city and telephone you would use a command such as:

```
QRCODEENCODEVCARD(FIELDSTR(first name),FIELDSTR(last name), FIELDSTR(address), FIELDSTR(city),'','','',FIELDSTR(telephone))
```

{% endstep %}

{% step %}
Click on `Format` on the left of the dialog
{% endstep %}

{% step %}
Change the field’s type to be `Barcode`
{% endstep %}

{% step %}
Change the type of barcode to be `QR Code`
{% endstep %}
{% endstepper %}
