QR vcard with photo

2 posts, 1 answers
  1. Bernie
    Bernie avatar
    27 posts
    Member since:
    Apr 2008

    Posted 08 Oct 2014 Link to this post


    I want to create a qr-code:
    string photo = @"PHOTO;PNG;ENCODING=BASE64:" + Convert.ToBase64String(File.ReadAllBytes(Server.MapPath(@"/Img/qr_test.png")));
    string vCardText = "BEGIN:VCARD\r\nVERSION:2.1\r\nN:";
    vCardText += "Name" + "\r\n";
    vCardText += "TEL;WORK;VOICE:" + "+00-0000-00000" + "\r\n";
    vCardText += "EMAIL;PREF;INTERNET:" + "peter.xxx@yyy.cc" + "\r\n";
    vCardText += photo + "\r\n";
    vCardText += "END:VCARD";
    RadBarcode barcode = new RadBarcode();
    barcode.Text = vCardText;
    barcode.Type = BarcodeType.QRCode;
    barcode.LineWidth = 1;

    System.Drawing.Image image = barcode.GetImage();

    I get following error:
    Parametername: The Text cannot be encoded with the current Version, ErrorCorrectionLevel and Mode.

    Please help! Thank you!
  2. Answer
    Konstantin Dikov
    Konstantin Dikov avatar
    2183 posts

    Posted 13 Oct 2014 Link to this post

    Hello Peter,

    The exception that you are receiving is due to the amount of data that you are setting to Text property of the RadBarcode control. Please take a look at the limitation of the QR codes depending on their mode:
    If you ensure that the provided information is within the range of maximum allowed symbols, the error should not be observed.

    Additionally, if your requirement is to display an image once the QR Code is read, the correct way for achieving this is by including an URL to the image.

    Konstantin Dikov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top