How to specify the error correction level to QRCodewriter?

Jan 29, 2013 at 8:46 AM

Hi, How to specify error correction level to my QR code writer.

Thanks in advance.

Coordinator
Jan 29, 2013 at 6:17 PM

If you want to use the BarcodeWriter class:

var content = "sample content";
var writer = new BarcodeWriter
{
   Format = BarcodeFormat.QR_CODE,
   Options = new ZXing.QrCode.QrCodeEncodingOptions
   {
      ErrorCorrection = ZXing.QrCode.Internal.ErrorCorrectionLevel.H
   }
};
var bitmap = writer.Write(content);

or if you want to use the more low level way:

var contents = "sample contents";
var hints = new Dictionary<EncodeHintType, object>();
hints.Add(EncodeHintType.ERROR_CORRECTION, ZXing.QrCode.Internal.ErrorCorrectionLevel.H);
var renderer = new ZXing.Rendering.BitmapRenderer();
var matrix = writer.encode(contents, BarcodeFormat.QR_CODE, 100, 100, hints);
var bitmap = renderer.Render(matrix, BarcodeFormat.QR_CODE, contents);

 

Jan 30, 2013 at 5:49 AM

Thank you.

Dec 31, 2013 at 9:31 AM
Hi,
why ZXing.QrCode.Internal.ErrorCorrectionLevel is internal in zxing.winmd project? so you cannot specify a different ERROR_CORRECTION.

thank you
Coordinator
Jan 6, 2014 at 9:02 PM
In the current source in the repository it is now public. Because of the restrictions for winmd assemblies it was internal before.
https://zxingnet.codeplex.com/SourceControl/changeset/87925
Jan 7, 2014 at 7:19 AM
thanks!