This project has moved. For the latest updates, please go here.

PDF417 Decoding Problem

Jan 14, 2015 at 5:50 PM
Using the .NET 4.0 version of the library I am trying to decode a PDF417 barcode from an image. My code is very straightforward and is below. Also I included a link to the image. For some reason I always get that the result is null even though the image that I'm using couldn't be clearer and simpler. What could I be doing wrong? Please let me know anything that could help.
IBarcodeReader ibc = new BarcodeReader();
            ibc.Options.TryHarder = true;

            Result res = ibc.Decode((Bitmap)Bitmap.FromFile(@"C:\Users\Ryan's Laptop\Desktop\Advanced ID Detection\testbc.jpg"));
            if (res != null)
            {
                Console.WriteLine(res.Text);
            }
http://commons.wikimedia.org/wiki/File:Sample_PDF417.png
Coordinator
Jan 14, 2015 at 7:35 PM
Internally the PDF417 code is decoded successfully.
BUT it has no content. It encodes an empty string.
The empty string is internally mapped to a null result.
That's a little bit misleading but it should not be an
issue in real world scenarios.
Jan 14, 2015 at 8:02 PM
Edited Jan 14, 2015 at 8:03 PM
Thanks micjahn. I was able to successfully decode a couple other ones after checking that they actually had content. Stupid mistake. After doing more testing, I found that the library wants the PDF417 barcode to be horizontal and also pure black and white. Is this correct?
Coordinator
Jan 14, 2015 at 8:28 PM
The barcode should be mainly horizontal oriented. Small rotations are possible.
The image has not to be pure black and white. But the PDF417 isn't as robust as other decoders like QR code for example.
It needs images with a higher quality.
Jan 16, 2015 at 4:13 PM
In case of PDF 417, Gray-scale image is working better then color image.
Jan 16, 2015 at 4:32 PM
Yeah that is what I found through lots of testing also. I had the best results with pure black and white images.