This is a migrated thread and some comments may be shown as answers.

QR vcard with photo

1 Answer 648 Views
Barcode
This is a migrated thread and some comments may be shown as answers.
Bernie
Top achievements
Rank 1
Bernie asked on 08 Oct 2014, 01:39 PM
Hi!

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!

1 Answer, 1 is accepted

Sort by
0
Accepted
Konstantin Dikov
Telerik team
answered on 13 Oct 2014, 08:37 AM
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.


Regards,
Konstantin Dikov
Telerik
 

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.

 
Tags
Barcode
Asked by
Bernie
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or