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

Encode features

Sep 24, 2013 at 10:12 AM

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

Thank You.
Sep 24, 2013 at 6: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("");
// or
var image = writer.Write(";SUB:Stuff;BODY:This is some text;;");
// or
var image = writer.Write("");

// 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" +
Sep 24, 2013 at 6:53 PM
Edited Oct 6, 2013 at 4:17 PM
Great ! This is it what I looked for ! Thanks !
Oct 6, 2013 at 4:17 PM
And Is it available for Windows Phone ?
Oct 6, 2013 at 5:14 PM
Of course.
The same way like for WinForms.
Nov 7, 2013 at 10:33 AM
How can I encode a image ?
Nov 12, 2013 at 8: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.
Nov 23, 2013 at 5:46 PM
Edited Nov 23, 2013 at 6: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("");
But it's not working.
Dec 1, 2013 at 7: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.

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.