pdf417 errorcorection level to change (from 2 to 5,6 ?)

Feb 16, 2014 at 12:03 PM
Thanks MicJahn for ZXing project.

I use http://sharpdevelop.com IDE and by default the pdf 417 error correction level is 2.
Can I change it? (I use .Net 4.0)

I try
IDictionary<EncodeHintType,object> hint =new Dictionary<ZXing.EncodeHintType,object>();
hint.Add(EncodeHintType.ERROR_CORRECTION, ZXing.QrCode.Internal.ErrorCorrectionLevel.H);

BitMatrix bitM = w.encode("my text to encode", ZXing.BarcodeFormat.PDF_417, 400,400, hint);

is not working (it still remain at 2).
Coordinator
Feb 16, 2014 at 7:31 PM
The current version (0.12) doesn't support this.
But I made a small patch:
https://zxingnet.codeplex.com/SourceControl/changeset/88194
How to use it:
var w = new BarcodeWriter
   {
      Format = BarcodeFormat.PDF_417,
      Options = new ZXing.PDF417.PDF417EncodingOptions
         {
            Height = 400,
            Width = 400,
            ErrorCorrection = ZXing.PDF417.Internal.PDF417ErrorCorrectionLevel.L5
         }
   };
w.Encode("my text to encode");
or with your snippet
IDictionary<EncodeHintType,object> hint =new Dictionary<ZXing.EncodeHintType,object>();
hint.Add(EncodeHintType.ERROR_CORRECTION, ZXing.PDF417.Internal.PDF417ErrorCorrectionLevel.L5);

BitMatrix bitM = w.encode("my text to encode", ZXing.BarcodeFormat.PDF_417, 400,400, hint); 
Feb 17, 2014 at 8:34 AM
Edited Feb 17, 2014 at 4:19 PM
Thank you for your quick answer.
Feb 17, 2014 at 8:36 AM
Edited Feb 17, 2014 at 4:20 PM
I can NOT use (from your patch) the WHITE_SPACE constants. (I use ZXing 0.12.0.0 source files from september 2013).
var margin = WHITE_SPACE; (in \pdf417\PDF417Writer.cs) at ~row 53.

I call without the margin parameter the
return bitMatrixFromEncoder(encoder, contents, width, height, errorCorrectionLevel);
Coordinator
Feb 17, 2014 at 7:19 PM
Please use the complete current source from the repository:
https://zxingnet.svn.codeplex.com/svn/trunk

The call to bitMatrixFromEncoder can not be changed without changing the method itself.
return bitMatrixFromEncoder(encoder, contents, width, height, margin, errorCorrectionLevel);
Feb 18, 2014 at 12:35 PM
Thank you!