This project has moved. For the latest updates, please go here.

Encode features

Sep 24, 2013 at 9:12 AM
Hello,

Is it possible to encode text, sms, email, card and more with ZXing.Net ?

Thank You.
Coordinator
Sep 24, 2013 at 5:51 PM
Of course.
First, create a barcode writer
var writer = new BarcodeWriter
{
   Format = BarcodeFormat.QR_CODE,
   Options = new EncodingOptions
   {
      Height = 400,
      Width = 400
   }
};
now you can encode your content
// normal text
var image = writer.Write("some normal text");

// a sms
var image = writer.Write("sms:+15551212?subject=foo&body=bar");

// an email
var image = writer.Write("mailto:john@example.org");
// or
var image = writer.Write("MATMSG:TO:john@example.org;SUB:Stuff;BODY:This is some text;;");
// or
var image = writer.Write("smtp:john@example.org:subject:body");

// vCard
var image = writer.Write("BEGIN:VCARD\r\nADR;HOME:123 Main St\r\nVERSION:2.1\r\nN:Doh;John\r\nEND:VCARD");

// vEvent
var image = writer.Write("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\n" +
             "DTSTART:20080504T123456Z\r\n" +
             "DTEND:20080505T234555Z\r\n" +
             "END:VEVENT\r\nEND:VCALENDAR");
Sep 24, 2013 at 5:53 PM
Edited Oct 6, 2013 at 3:17 PM
Great ! This is it what I looked for ! Thanks !
Oct 6, 2013 at 3:17 PM
And Is it available for Windows Phone ?
Coordinator
Oct 6, 2013 at 4:14 PM
Of course.
The same way like for WinForms.
Nov 7, 2013 at 9:33 AM
How can I encode a image ?
Coordinator
Nov 12, 2013 at 7:14 PM
You have to convert the image into a string representation like Base64.
But the main problem would be the restriction of the qr codes. One qr code can only contain up to
4296 alpha-numeric characters. If you want to encode larger images you have to
split them across more than one qr code.
http://en.wikipedia.org/wiki/Qr_code
Nov 23, 2013 at 4:46 PM
Edited Nov 23, 2013 at 5:24 PM
  1. How can I split them across more than one qr code ?
  2. How can I encode image if I have converted into Base64 ?
QrCodeImage.Source = writer.Write(baseString);
It's not working.
  1. I'm trying to encode URL, like this:
QrCodeImage.Source = writer.Write("URLTO:google.com/m");
But it's not working.
Coordinator
Dec 1, 2013 at 6:59 PM
First you have to explain what do you mean with "it's not working"!

I have found a link which gives some answers to your question about encoding images and splitting data across more than one code.
http://stackoverflow.com/questions/12905485/storing-a-bmp-image-in-a-qr-code

The "urlto" has to be supported by the reader which you are using.
There are many readers for smart phones which doesn't jump automatically to an url.

The same is true for images. There is no "standard" encoding for images within qr codes.
The reader has to support the format which you are using. That means normally you have to write
your own reader which converts back the base64 data to an image.