Wednesday, October 10, 2012

ZXing QR barcode C# Example


BarcodeWriter BW = new BarcodeWriter();
BW.Format = BarcodeFormat.QR_CODE;
var bitmap =BW.Write("This is Bar Code Text");

How to hide user readable text in code 128?


public class PureBarcodeRenderer : ZXing.Rendering.BitmapRenderer
{
   public override Bitmap Render(BitMatrix matrix, BarcodeFormat format, string content, EncodingOptions options)
   {
      return base.Render(matrix, format, null, options);
   }
}

var writer = new BarcodeWriter
                {
                   Renderer = new PureBarcodeRenderer(),
                   Format = BarcodeFormat.CODE_128,
                   Options = new EncodingOptions
                                  {
                                     Height = 100,
                                     Width = 300
                                  }
                            };
var image = writer.Write(content);

How to hide user readable text in code 128?


public class PureBarcodeRenderer : ZXing.Rendering.BitmapRenderer
{
   public override Bitmap Render(BitMatrix matrix, BarcodeFormat format, string content, EncodingOptions options)
   {
      return base.Render(matrix, format, null, options);
   }
}

var writer = new BarcodeWriter
                {
                   Renderer = new PureBarcodeRenderer(),
                   Format = BarcodeFormat.CODE_128,
                   Options = new EncodingOptions
                                  {
                                     Height = 100,
                                     Width = 300
                                  }
                            };
var image = writer.Write(content);

C# ZXing.Net Code 128 Bar Code Example


var writer = new BarcodeWriter
                {
                   Format = BarcodeFormat.CODE_128,
                   Options = new EncodingOptions
                                  {
                                     PureBarcode = true,
                                     Height = 100,
                                     Width = 300
                                  }
                            };
var image = writer.Write(content);