How do I add a vCard to a QR code?

What is a QR code?

A QR code is a type of two dimensional barcode, like the one in the picture below. Many smartphones can scan these codes using their cameras and free apps. The codes can either contain URLs that will take you directly to a website, or they can contain contact information that will populate a contact card for your phone's Address Book.


What is a vCard?

vCard stands for "Virtual Business Card." It is a data format that packages up address book information, like a person's name, title, organization, mailing address and telephone numbers. It can be attached as a file to emails, or downloaded from a web page, or encoded into a QR code. It is an older standard than the QR code, but the two work very well together.


How are they used together for a scannable business card?

When a QR code that contains vCard information is printed on a business card, a person can scan it with their smartphone, and it immediately becomes a contact in their Address Book. No manual typing is needed.


How can I use this within an eDocBuilder template?

Set up your master PDF as you normally would, with all the regular fields for displaying name, address, etc. Then add an additional, fairly large, square field to hold the QR code. 

Important: In order for the QR code to work with the widest variety of smartphone apps, there are some general rules you should follow when creating your template fields:

-- First and last name fields should be separate

-- The address should be separated (e.g., City, State and Zip should each be its own user entry field)


For this example, we will assume you have named your fields with the following naming conventions:

phFirstname, phLastName, phCompanyName, phTitle, phAddressOne, phAddressTwo, phCity, phState, phZip, phPhone, phTelephoneExt, phFax, phCell, phEmail, phWebsite, QRCode


In eDocBuilder, create your template and upload the master PDF. Format all the normal, visible fields as you ordinarily would. Then open the QRCode field. In the Field Type tab, select "Barcode" and "Static Text or Field Scripting":

 


In the Format tab, select QR code, and the color you want the code to be. The default is CMYK Black (0 0 0 100):


In the Field Scripting tab, select "HTML Markup", and enter the following script:


BEGIN:VCARD
N;CHARSET=utf-8:@phLastName@;@phFirstname@
FN;CHARSET=utf-8:@phFirstname@ @phLastName@
ORG;CHARSET=utf-8:@phCompanyName@
TITLE;CHARSET=utf-8:@phTitle@
TEL:@phPhone@ {{x@phTelephoneExt@}}
TEL;CELL:@phCell@
TEL;FAX:@phFax@
EMAIL;TYPE=INTERNET:@phEmail@
ADR:@phAddressOne@;@phAddressTwo@;@phCity@;@phState@;@phZip@;USA
URL:@phWebsite@
VERSION:2.1
END:VCARD


If there are fields you are not using, leave those lines out of the script. If you are not using all of the fields within a particular line, you may need to replace the missing fields with semicolons.
Note that if you have not used the naming conventions previously referenced, you will need to update the names of the fields to correctly match those being used in your template. 

If you would like to use a vCard with VBscript formatting, you will need to replace the line breaks with ChLF. For example:

"BEGIN:VCARD" & ChLF & "N;CHARSET=utf-8:" & phLastName & ";" & phFirstName & ChLF & "FN;CHARSET=utf-8:" & phFirstName & " " & phLastName & ChLF & "ORG;CHARSET=utf-8:" & phCompanyName & ChLF & "TITLE;CHARSET=utf-8:" & phTitle & ChLF & "TEL:" & phPhone & ifs(phTelephoneExt<>, "x" & phTelephoneExt, "") & ChLF & "TEL;CELL:" & phCell & ChLF & "TEL;FAX:" & phFax & ChLF & "EMAIL;INTERNET:" & phEmail & ChLF & "ADR;:" & phAddressOne & ";" & phAddressTwo & ";" & phCity & ";" & phState & ";" & phZip & ";USA" & ChLF & "URL:" & phWebsite & ChLF & "VERSION:2.1" & ChLF & "END:VCARD"



ADDITIONAL NOTES & TIPS

  • Do not copy and paste the script directly from your web browser into eDocBuilder, as the formatting used to display it in your browser will also be copied and may make your script work incorrectly. Please first paste the script into a plain text editor (such as Notepad). Then, copy the script from the plain text editor and paste it into the Field Scripting tab of your field in eDocBuilder.

  • If you are using VBscript instead of HTML, ensure that the "Suppress blank lines" option is not checked.

  • In order to print an ISO 18004-compliant QR code, the absolute minimum scannable size is 1 cm x 1 cm, or .4" x .4”. However, a QR code this size won’t necessarily be scannable by all smartphones. If you want to guarantee that most smartphones will be able to scan your QR code, the smallest size you should the QR code should be printed at is 2 cm x 2 cm, or .8" x .8”.

  • There is no maximum size for a QR code, but you do want to keep in mind scannability. If your code is too large for the distance, it will be difficult to scan. For example, a QR code placed on a table, where customers will be scanning it up close won’t need to be as large as a QR code placed on the wall.

  • The general rule is that you need to maintain a distance-to-size ratio of 10:1. A QR code printed on an instruction pamphlet will be scanned from only a few inches away, so you can likely print a much smaller QR code. On the other hand, a QR code on the wall will need to be much bigger because it will be scanned from farther away.

  • QR codes use black and white squares to represent data. The more data you need to encode, the more rows and columns you’ll need to fit onto your QR code, and the smaller those dots will be. If you need to encode a lot of data, you’ll need to print your QR code larger so that the code is scannable.

  • The more information encoded in your QR Code, the larger it will be and the more slowly it will scan. If you’d like to reduce the size of a QR code, try using fewer characters or less information. If including a lengthy website URL in your script, you can try shortening the URL with a service like Tiny URL or Bitly.

  • The resolution of the QR code you print can affect how scannable it is. If you need to print a smaller QR code, you’ll want to make sure you print it at a high resolution. If you’re unable to print at a high resolution, increase the size by .2” per every five columns and rows.

  • QR codes need dark dots on a light background to be scannable. Never use light dots on a dark background.

  • There are different versions of vCard file format standards: 2.1, 3.0, and 4.0. Newer file formats differ mainly in that they allow additional detailed informational fields (reference: https://en.wikipedia.org/wiki/VCard#Properties). If you are utilizing version 2.1 as referenced in the example script, but notice that some of your characters are not populating as expected when scanned (such as accented characters like é, à and û), you may wish to try switching to a different version of vCard formatting. Most of the script can remain the same, simply change the number in and location of the version line, as shown below:

    • BEGIN:VCARD
      VERSION:3.0
      N;CHARSET=utf-8:@phLastName@;@phFirstname@
      FN;CHARSET=utf-8:@phFirstname@ @phLastName@
      ORG;CHARSET=utf-8:@phCompanyName@
      TITLE;CHARSET=utf-8:@phTitle@
      TEL:@phPhone@ {{x@phTelephoneExt@}}
      TEL;CELL:@phCell@
      TEL;FAX:@phFax@
      EMAIL;TYPE=INTERNET:@phEmail@
      ADR:@phAddressOne@;@phAddressTwo@;@phCity@;@phState@;@phZip@;USA
      URL:@phWebsite@
      END:VCARD


    • BEGIN:VCARD
      VERSION:4.0
      N;CHARSET=utf-8:@phLastName@;@phFirstname@
      FN;CHARSET=utf-8:@phFirstname@ @phLastName@
      ORG;CHARSET=utf-8:@phCompanyName@
      TITLE;CHARSET=utf-8:@phTitle@
      TEL:@phPhone@ {{x@phTelephoneExt@}}
      TEL;CELL:@phCell@
      TEL;FAX:@phFax@
      EMAIL;TYPE=INTERNET:@phEmail@
      ADR:@phAddressOne@;@phAddressTwo@;@phCity@;@phState@;@phZip@;USA
      URL:@phWebsite@
      END:VCARD


  • All versions of vCard file formats are internet-based international standards, and not created, maintained or administered by Aleyant in any way. If you require assistance with adjusting an existing vCard script that you have already prepared, please submit a Support ticket, and we will provide as much corrective guidance and assistance as we are able.

    Please note: Support cannot directly write a new vCard script for you. However, you can submit a ticket to Professional Services to request a quote for completing such a project.