This project has moved and is read-only. For the latest updates, please go here.

vCard encoding

May 4, 2013 at 11:20 AM
I have a problem with generation vCard as a qrcode
I tried with string builder but qr generator support only string :/
StringBuilder sb = new StringBuilder();
sb.AppendLine("BEGIN: VCARD");
sb.AppendLine("N:Kowalchik;Michael");
sb.AppendLine("ORG:TenZeroLab");
sb.AppendLine("TITLE:Founder");
sb.AppendLine("EMAIL:mikepk@tenzerolab.com");
sb.AppendLine("END:VCARD");

QRCodeWriter writer = new QRCodeWriter();
var bMatrix = writer.encode(sb, BarcodeFormat.QR_CODE, 25, 25);
var asBitmap = bMatrix.ToBitmap();
Image1.Source = asBitmap;
It doesn't work at all
Does anybody could help me??
May 4, 2013 at 12:53 PM
Edited May 4, 2013 at 12:56 PM
Please try the following code snippet:
var sb = new StringBuilder();
sb.AppendLine("BEGIN:VCARD");  // there was a space before VCARD which had to be removed
sb.AppendLine("N:Kowalchik;Michael");
sb.AppendLine("ORG:TenZeroLab");
sb.AppendLine("TITLE:Founder");
sb.AppendLine("EMAIL:mikepk@tenzerolab.com");
sb.AppendLine("END:VCARD");

var writer = new BarcodeWriter
   {
      Format = BarcodeFormat.QR_CODE,
      Options = new QrCodeEncodingOptions {Width = 25, Height = 25}
   };
var bitmap = writer.Write(sb.ToString());
Image1.Source = bitmap;
May 5, 2013 at 9:37 PM
It works
Thank U ;)
May 6, 2015 at 4:54 PM
Is it possible to embed profile image in vCard? I want to save the vCard directly in mobile phone.