Free Support Forum - aspose.com

Problem recognizing printed PDF417 barcode

Hi.
I am trying to read some pages printed with PDF417 barcodes. Those barcodes were generated with version 5.4 of Aspose.Barcode.
We could not find a way to read them with the latest version of Aspose.Barcode or with version 5.4.
The problem is that we do not have the original data. We only have the printed sheets.
In topic 28751 I have put some comments and the Aspose support people have kindly told me to open a new thread.
I attach an image that cannot be read (generated with version 5.4) and one that can (generated with 2.5). I also indicate the code used to read. Although in reality we used physical readers.
Thanks a lot
Bad.jpg (364.4 KB)
Good.jpg (366.0 KB)


var barCodeLicense = new Aspose.BarCode.License();
barCodeLicense.SetLicense(xxxxxxxxxxxxxx\Aspose.Total.lic");

        // Good
        //var rutaOrigen = @"\xxxx\Imagenes\Good";
        //var rutaDestino = @"xxxxx\Imagenes\Good\Good-trans-barcode-20.10.zip";
       

        // Bad
        var rutaOrigen = @"xxxxxx\Imagenes\Bad";
        var rutaDestino = @"xxxx\Imagenes\Bad\Bad-trans-barcode-20.10.zip";

        using (var writer = File.OpenWrite(rutaDestino))
        {
            var ficheroImagen = @"Bad.jpg";
            var files = new DirectoryInfo(rutaOrigen).GetFiles(ficheroImagen, SearchOption.TopDirectoryOnly);

            var encoding = Encoding.GetEncoding("ISO-8859-1");

            foreach (var strFile in files.OrderBy(s => s.Name))
            {
                using (var reader = new BarCodeReader(strFile.FullName, DecodeType.MacroPdf417))
                {
                    foreach (BarCodeResult result in reader.ReadBarCodes())
                    {
                        var data = encoding.GetBytes(result.CodeText);
                        writer.Write(data, 0, data.Length);
                    }
                }
            }
        }

Note:
The code is also prepared to read the barcodes individually instead of in a single .jpg file

I tested both of these files with 5.4 and 20.11(developer) versions and both versions cannot read these barcodes. Also no side engine cannot read barcodes from these images. May be you have images with better resolution?

We only have the printed sheets.

Do you have printed sheets on paper or only scanned? If you have on paper, you can increase scanning resolution and try yet one time.

Hi @alexander.gavriluk
I attach image files with higher resolution.
I also attach the files obtained in each of the cases.
As you will see, the result in both cases is a .ZIP file. In one case it is a correct ZIP (it has a password but it is valid) and in another it is wrong.
The reading example is made with version 20.10

GoodV2.jpg (2.1 MB)
GoodV2-barcode-20.10.zip (2.0 KB)

BadV2.jpg (2.1 MB)
BadV2-barcode-20.10.zip (2.0 KB)

We only have the printed sheets.
The examples that we have attached we have currently obtained with the same program. That program generates a PDF. I have sent you the JPG files of the page that contains the barcodes.

Thanks

With 20.11(develop version) everything is read well. May be here is problem with in 20.10 version (we fixed one rare bug with byte latch mode in pdf417 text mode stream), but I do not sure that this bug makes barcode unreadable.

string lFolder = @"d:\save\rec\";
BarCodeReader reader;

int lGoodPDFCounts = 0;
reader = new BarCodeReader(Path.Combine(lFolder, "GoodV2.jpg"), DecodeType.Pdf417, DecodeType.MacroPdf417);
lGoodPDFCounts = reader.ReadBarCodes().Length;

int lBadPDFCounts = 0;
reader = new BarCodeReader(Path.Combine(lFolder, "BadV2.jpg"), DecodeType.Pdf417, DecodeType.MacroPdf417);
lBadPDFCounts = reader.ReadBarCodes().Length;

string result = "Good barcodes read:" + lGoodPDFCounts.ToString() + " Bad barcodes read:" + lBadPDFCounts.ToString();
MessageBox.Show(result);

Ok, I understand you do not have barcode reading problem (it is read) you have problem with barcode decoding, because it is decoded incorrectly (generated in version 5.4)?

Was this question?

That’s exactly it.
With Aspose, the two cases are read but as a result one of them is not valid.
The starting data in both cases are the same.
When we read them with physical readers, the same thing happens.

@RubenL,
We will analyze this information and share our feedback soon.