ZXing.Net Encode string to QR Code in CF

@dizzytri99er

Seems that I have sucessfully encoded a message with ZXing.net therefore I think it does support Aztec encoding

This is the code I have used;

    static void Main(string[] args)
    {
        IBarcodeWriter writer = new BarcodeWriter
            {
                Format = BarcodeFormat.AZTEC
            };
        Bitmap aztecBitmap;
        var result = writer.Write("I love you ;)");
        aztecBitmap = new Bitmap(result);

        using (var stream = new FileStream("test.bmp", FileMode.OpenOrCreate, FileAccess.ReadWrite))
        {
            var aztecAsBytes = ImageToByte(aztecBitmap);
            stream.Write(aztecAsBytes, 0, aztecAsBytes.Length);
        }
    }


    public static byte[] ImageToByte(Image img)
    {
        ImageConverter converter = new ImageConverter();
        return (byte[])converter.ConvertTo(img, typeof(byte[]));
    }

You don't fully initialize the BarcodeWriter. You have to set the barcode format.

Try the following code snippet:

IBarcodeWriter writer = new BarcodeWriter { Format = BarcodeFormat.QR_CODE };
var result = writer.Write("Hello");
var barcodeBitmap = new Bitmap(result);
pictureBox1.Image = barcodeBitmap;