Hello,
While continuing my testing of the new Aspose PDF.Kit and Aspose.BarCode 3.1.1 I found that out of five scanned test documents I had two barcodes that were found, but the value was incorrect.
The value for the barcode in 20091230155611005.pdf should be "0:133387;0" but it read as 0:13339707532716.
The value for the barcode in 20091230155737397.pdf should be "0:133389;0" but it read as 3H(6TC3d;0.
I reverted back to Version 2.8 and it is recognizing these barcodes correctly. I have a great concern about incorrectly recognizing a barcode. I would rather see a failure instead of a misread.
Regards,
Don Tompkins
Hi Don,
The latest release of Aspose.BarCode for .NET is 3.1.0. For scanned documents, please add the following line of code before calling Read() method:
reader.SetHints(RecognitionHints.ImageBinarizationHints.MedianSmoothing);
Below are the my test results with the 2 posted pdf files:
File: 20091230155611005.pdf, Codetext found: 0:133387;0
File: 20091230155737397.pdf, Codetext found: 0:133389;0
Below is the code that I used to test these files:
try
{
// bind the pdf
PdfExtractor extractor = new PdfExtractor();
extractor.BindPdf(@“e:\data\aspose\temp\20091230155737397.pdf”);
// set page range for image extraction
extractor.StartPage = 1;
extractor.EndPage = 1;
// extract the images
Console.Write(“Extracting images…”);
extractor.ExtractImage();
DateTime dtEndTime = DateTime.Now;
int i = 1;
// save images to stream in a loop
while (extractor.HasNextImage())
{
Console.Write(“Getting next image…”);
dtStartTime = DateTime.Now;
// save to stream
MemoryStream stream = new MemoryStream();
extractor.GetNextImage(stream);
Bitmap bmp = new Bitmap(stream);
stream.Position = 0;
Console.Write(“Recognizing barcode…”);
// recognize the barcode from the image stream above
BarCodeReader reader = new BarCodeReader(new Bitmap(stream), BarCodeReadType.Code128);
reader.SetHints(RecognitionHints.ImageBinarizationHints.MedianSmoothing);
while (reader.Read())
{
Console.WriteLine(" == Codetext: " + reader.GetCodeText());
}
reader.Close();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}