Jump to content

Proper QR code for vCard Contact example


dmp

Recommended Posts

Hi there,

I think the QR code functionality could be a bit better, I think I read somewhere that Mr. Korn was asking for an example of one in order to check the coding?

 

This is where I make vCard's and they come out fantastical.

All the addresses and numbers are properly coded it seems as when I use a (good) barcode scanner on my phone it puts everything in the right contact field. Give the vCard a try. I would love to be able to use fusion pro to make these as re-typing everything many times is incredibly mind(finger?) numbing :)

 

http://keremerkan.net/qr-code-and-2d-code-generator/

 

Dan, not sure if you could work your magic on this but I would greatly appreciate it being able to use all these fields in fusion pro.

-Mike

Link to comment
Share on other sites

There's absolutely no reason why you can't generate a barcode with all of that data from FusionPro.

 

I filled out just about all the fields on the form on that web page, scanned the barcode to get the data, and wrote a rule in FusionPro which generates an equivalent barcode:

var data = [ "BEGIN:VCARD",
           "VERSION:3.0",
           "N:Kent;Clark;W;;",
           "FN:Clark W Kent",
           "ORG:Daily Planet",
           "TITLE:Senior Reporter",
           "EMAIL;type=INTERNET;type=WORK:clark.kent@dailyplanet.com",
           "TEL;type=CELL:800-555-1212",
           "TEL;type=WORK:212-787-3762 x 6",
           "TEL;type=HOME:800-579-7866",
           "ADR;type=WORK:;;One Daily Planet Way;Metropolis;NY;11111;USA",
           "ADR;type=HOME:;;One Jor El Place;Krypton City;Krypton;32.54323;Kryptonian Planetary Alliance",
           "BDAY;value=date:1932-01-01",
           "URL;type=WORK:http://www.dailyplanet.com",
           "URL;type=HOME:http://www.iamnotsuperman.com",
           "END:VCARD" ];
return MakeQRBarcodeGraphic(data.join("\n"));

You could do this with variable data by simply hooking those vCard fields up to data fields in your FusionPro job, like so:

// vCard format
// http://en.wikipedia.org/wiki/VCard
// Note that support for vCard may be more limited than for MECARD,
// and that vCard requires more data to be encoded, resulting in a denser barcode.

var info = {
   N: Field("LastName") + ';' + Field("FirstName") + ';' + Field("MiddleName") + ';;',
   FN: Field("FirstName") + ' ' + Field("MiddleName") + ' ' + Field("LastName"),
   ORG: Field("Company"),
   TITLE: Field("Title"),
   "EMAIL;type=INTERNET;type=WORK": Field("Email"),
   "TEL;type=CELL": Field("MobilePhone"),
   "TEL;type=WORK": Field("WorkPhone"),
   "TEL;type=HOME": Field("HomePhone"),
   "ADR;type=WORK": ";;" + Field("WorkStreet") + ';' + Field("WorkCity") + ';' + Field("WorkState") + ';'
                           + Field("WorkZIP") + ';' + Field("WorkCountry"),
   "ADR;type=HOME": ";;" + Field("HomeStreet") + ';' + Field("HomeCity") + ';' + Field("HomeState") + ';'
                           + Field("HomeZIP") + ';' + Field("HomeCountry"),
   "BDAY;value=date": Field("Birthday"),
   "URL;type=WORK": Field("WorkURL"),
   "URL;type=HOME": Field("HomeURL"),
}

var result = ["BEGIN:VCARD", "VERSION:3.0"];
for (var label in info)
{
   if (info[label])
       result.push(label + ":" + info[label]);
}
result.push("END:VCARD");

return MakeQRBarcodeGraphic(result.join(Chr(13) + Chr(10)));

Again, FusionPro can generate the QR barcode with whatever data you want. The (various versions of the) vCard standard specifies a particular format for the data, but that can all be done in a FusionPro rule. The built-in XML template rule for vCard data isn't quite as sophisticated as the webpage cited in terms of number of fields presented, but anyone could create a new version of that XML template based on the JavaScript logic above, and customize it further, as there are literally hundreds of other vCard fields available. That said, I think a more likely use case for FusionPro would be a custom rule to generate vCard data tied specifically to either a set of data fields on a particular form on a web-to-print app, or a set of data fields defined in a data file for a VDP job, in which case you probably need custom JavaScript logic that's hard to generalize into an XML template.

 

Finally, as I've said before, the ability of devices to be able to properly parse out the vCard data and populate it into a contact or address book entry varies greatly, but that's not a limitation of any kind on FusionPro's end.

Link to comment
Share on other sites

  • 4 months later...

Dan,

 

Is the "MakeQRBarcodeGraphic" function something that came in with the 7.2 version or the newer 8.0 version? Would this script of yours work on version 7.2?

 

I have version 7.1 and was trying to make a hybrid of the script to fit your version 2.1 VCard script using the QR.Make command. The barcode came out "looking" correct and when scanned by an Andriod and an iPhone they both recognized it as an address but no information was passed.

 

I think I need to upgrade but it will be a time before I can do that.

.

Link to comment
Share on other sites

Is the "MakeQRBarcodeGraphic" function something that came in with the 7.2 version or the newer 8.0 version? Would this script of yours work on version 7.2?.

The MakeQRBarcodeGraphic function was introduced in FusionPro 7.2. The rule will work fine there (although of course it has to be in a graphic rule). Note that my previous post was from January, before 8.0 was released.

I have version 7.1 and was trying to make a hybrid of the script to fit your version 2.1 VCard script using the QR.Make command.

If you change it to MakeQRBarcode (or QR.Make) and use it in a text rule, then it will work going all the way back to version 7.0, where we first introduced support for QR barcodes. The barcode itself should be the same whether you generate it as text or as a graphic; the only disadvantage of using the text version is that it's harder to scale/copyfit to a particular output size. At any rate, I don't know why you wouldn't want a free upgrade from 7.1 to 7.2.

The barcode came out "looking" correct and when scanned by an Andriod and an iPhone they both recognized it as an address but no information was passed.

I'm not sure what you mean by, "no information was passed." Do you mean that the contact information was not properly imported? As I've said many times before, the ability of different scanning devices and apps on different platforms to interpret vCard contact data and import it into an address book varies greatly. But these are issues with those devices; there's absolutely no limitation on FusionPro's end. You can encode literally any data you want; it's just a matter of properly building up the vCard data in a rule.

 

And I'll repeat the same suggestion/challenge that I've offered to everyone else: Find a barcode that does scan and import properly to your device, post it here, and then I, or really, anyone else, can scan it, see what raw data it encodes, and create a rule to encode equivalent data based on VDP fields.

Link to comment
Share on other sites

  • 2 months later...

O.K. we've made the jump to FusionPro 8.0.20 and I am able to use the "MakeQRBarcodeGraphic" command instead of the font version, however I now have a question about the displaying of this type of graphic.

 

Is there a way to change the color of the graphic styled barcode?

 

Our customer wants the display to be the same color as the printed version of their business cards. There business cards will be Reflex Blue, and the want this "on screen proof" to be an "exact replica of their printed card". So far I can only see how to make the barcode and not change the color of the barcode. At least with the font version I was able to change the color of the font. I seem to have a problem no matter which method I use.:confused:

 

Meth. 01 - If I use the font version I can change the color, but I can't resize the output using the copyFit functions so I am limited in the amount of characters that I can allow in the barcode. Not what the customer wants.

 

Meth. 02 - If I use the graphic version I can resize the output at will so I don't have the character limitation as with the font version, but I am limited to only displaying the graphic as black. Again, not what the customer wants.

 

A little help please...:o

.

Link to comment
Share on other sites

I am asking for help under this thread as this is what has helped me the most so far. I have qr code generator rule on a business card. My customer would like more information. It seems I need to create a vcard qr code instead. I used the example above and it is not reading. I have attached my code and my qrcode that doesn't work, plus a qr code that gives me correct output (created using the site listed at the top of this thread).

 

I have been futzing with this all day. :(

 

Thanks,

vcard rule.txt

BacodeSample_not working.pdf

SampleVCard.pdf

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...