Saturday, 23 July 2016

Generating QR Code Personal Business Cards

It's been a long time since my last post, time flies, and I am embarked in a very important project, one in my life Master Plan, eheheh, that is preventing me from publishing posts in both blogs.

These days I have had the need to print some personal cards and I thought It would be a good idea to embed a QR code with my vCard, so that other people I meet at conferences and events can easily add me to their contact list with all information I am willing to share with them. Also, it might be interesting to add in a techy resume.

It was interesting to read a bit about how QR were invented, and the different formats and versions there exists. Reading about its encoding and error correction transported me to my days of Electrical Engineering student.

On the other hand, vCard format, described on RFC6350, is a standard format to share contact details commonly used by phones and internet applications. Like many internet formats, it is human readable, so it is easy to craft one's vCard with the fields you want to include. Skimming RFC6350 you might get surprised how many interesting fields you can include in your vCard, from your private encryption keys to an URL pointing to the most updated vCard of you, in case you change contact details such as address or phones frequently. Not sure how many contacts application make use of the last one.

To generate a QR-Code I have used qrcode Python package, which enable to create a QRcode image in just three lines of code. Since it is pip compliant, one can easily install the package with the following command:

>sudo -H pip install qrcode 

Once we have qrcode up and running on our python distribution, we can use the code below, included in my github repository to generate the QR code. The vCard file is downloaded from my website, you can easily craft yours with a text editor and then feed this text to the qr.add_data() function.

As usual you can get the code at my github profile:

The result is a QR-code that can be inserted in your business cards or in your resume. The more information you add to your vCard, the more characters the QRcode needs to encode and thus, the bigger it gets. Hence, I strongly encourage to add only the important information and add a field such as your personal website where more information can be found if needed. Another option is encoding instead an URL pointing to a more complete vCard stored in your website.