We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Bar Code random numbers

Hello, We are using your bar code product Lic ver 3.0, the issue we are having when it reads bar code we see random numbers, also some of the tif file does not read. In the screen shot second part is bar code stating with 99 but first part (3141764) we are not sure where that came from. Sometimes it gives some random number our bar code starts with 99, Attach 2 screen shots examples. Here is the code we need your help.


thanks
Solomon

namespace BarcodeTester
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
var x = this.openFileDialog1.ShowDialog();
if (x == System.Windows.Forms.DialogResult.OK)
{
this.textBox1.Text = this.openFileDialog1.FileName;
}
}

private void button2_Click(object sender, EventArgs e)
{
this.dataGridView1.DataSource = GetDataTable();
this.dataGridView1.Refresh();

if (string.IsNullOrWhiteSpace(this.textBox1.Text))
{
MessageBox.Show(“Enter File”);
this.textBox1.Focus();
return;
}

if (!(File.Exists(this.textBox1.Text.Trim())))
{
MessageBox.Show(“File not found”);
this.textBox1.Focus();
return;
}

this.dataGridView1.DataSource = this.Process(this.textBox1.Text.Trim());
}

private static DataTable GetDataTable()
{
DataTable dt = new DataTable();
dt.Columns.Add(“Document #”, typeof(int));
dt.Columns.Add(“BarCode”);
return dt;
}

public DataTable Process(string FilePath)
{
DataTable dt = GetDataTable();

if (File.Exists(FilePath))
{
using (Image img = GetImage(FilePath))
{
int totalFrame = img.GetFrameCount(FrameDimension.Page);

if (totalFrame > 0)
{
Aspose.BarCode.License license = new Aspose.BarCode.License();
license.SetLicense(“Aspose.BarCode.lic”);

string BarCodeReadType = ConfigurationManager.AppSettings[“BarCodeReadType”];
string BarCodePrefix = ConfigurationManager.AppSettings[“BarCodePrefix”];

// IEnumerable<RecognitionHints.Orientation> directions = Enum.GetValues(typeof(RecognitionHints.Orientation)).Cast<RecognitionHints.Orientation>();

int i = 0;
while (i < totalFrame)
{
DataRow dr = dt.NewRow();
dr[0] = i + 1;

// Set the active page and feed it to the BarCodeReader
img.SelectActiveFrame(FrameDimension.Page, i);

using (Bitmap page = new Bitmap(img))
{
List bam = new List();
// int j = 0;
// while ((j < directions.Count()))
// {

using (BarCodeReader reader = new BarCodeReader(page, (BarCodeReadType) Enum.Parse(typeof(BarCodeReadType), BarCodeReadType)))
{
reader.ImageBinarizationHints = RecognitionHints.ImageBinarization.MedianSmoothing;
// reader.OrientationHints = directions.ElementAt(j);

while (reader.Read()) // && dr.IsNull(“BarCode”))
{
bam.Add(reader.GetCodeText());
}

reader.Close();
}

// j++;
//}

string s = null;
foreach (string s2 in bam)
{
if (s != null)
s += ‘,’;
s += s2;
}

dr[“BarCode”] = s;
}

dt.Rows.Add(dr);
i++;
}
}
}
}

return dt;
}

public Image GetImage(string filePath)
{
Image img = null;

bool wait = false;
while (img == null)
{
if (wait)
System.Threading.Thread.Sleep(1000);
else
wait = true;

try
{
img = Image.FromFile(filePath);
}
catch { };
}

return img;
}
}
}

Hi Solomon,


Thank you for contacting support. We’re working over your query and will get back to you soon.

Hi Solomon,


Thank you for being patient. Please provide us your sample barcode images for testing purposes. We’ll take a closer look and reply you accordingly.

I attach two examples they both read the bar code but as you can see, first attachment first part 22683, second part is bar code stating with 99. The second attachment same thing it has that extra number 18497 and sending part is bar code starts with 99. So we are not sure what is extra numbers in front, Some of the tif images not reading bar code with same resolution.

Hi Solomon,


Thank you for supplying sample barcode pictures. We have tested them against the latest build of Aspose.BarCode for .NET 6.9.0 and managed to replicate the problems said. It looks as incorrect recognition of the codes those not starting with “99”. We have logged these issues as follows:

File Name: 20150521125600016_0001.tif
BARCODENET-34180 - Incorrect recognition of Planet code from the tif image

File Name: 20150521125508119_0001.tif
BARCODENET-34181 - Incorrect recognition of Planet code from the tif image

Your post has also been linked to these issues. We’ll keep you informed regarding any available updates. We’re sorry for the inconvenience caused.

I need to update my manager regarding issue with bar code, when you think it will be resolved. We purchase your software just few months back.

Thank you for prompt reply.

Hi Solomon,


Thank you for the inquiry. This issue has just been identified and our product team requires a little time to investigate it. Once it is fixed, then you will get an email intimation. Furthermore, we keep our customers informed regarding any available updates.

Hi Solomon,


Thank you for being patient. We have a good news for you that the issue id BARCODENET-34181 has now been resolved. If there is no issue in the QA phase, then this fix will be included in the next version of Aspose.BarCode for .NET 7.1.0. We’ll inform you via this forum thread as soon as the new release is published.

Hello Imran,

Thank you for update what is the time frame for new version of Aspose.BarCode for .NET 7.1.0.

thanks

Solomon

Hi Solomon,


Thank you for the inquiry. It’s expected in the first or second week of July, 2015. It’s all depend if everything goes by plan.

Hi Solomon,


Thank you for being patient. We have a good news for you that the issue id BARCODENET-34180 has now been resolved. If there is no issue in the QA phase, then this fix will be included in the next version of Aspose.BarCode for .NET 7.1.0. We’ll inform you via this forum thread as soon as the new release is published.

The issues you have found earlier (filed as BARCODENET-34181;BARCODENET-34180) have been fixed in Aspose.BarCode for .NET 7.1.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

I am using same code above except replace with new dll Ver .NET 7.1 Now I am

getting ‘System.OutOfMemoryException’ occurred in mscorlib.dll any way to resolve this issue.



thank you
Solomon

Hi Solomon,


Thank you for the inquiry. Please note, the image binarization hints property has been marked as obsolete. Please use barcode recognition modes as narrated in this help topic: Switch Barcode Recognition Modes According to the Requirement

We did not notice the out of memory exception message. Please use this sample code and let us know your feedback:

[.NET, C#]
string filename = @“C:\AB\test382\20150521125508119_0001.tif”;
using (BarCodeReader reader = new BarCodeReader(filename, BarCodeReadType.Planet))
{
reader.RecognitionMode = RecognitionMode.MaxQuality;
while (reader.Read())
{
Console.WriteLine(reader.GetReadType() + ": " + reader.GetCodeText());
}
}

Results:
File Name: 20150521125508119_0001.tif
Planet: 990000836439
Planet: 990000836439

File Name: 20150521125600016_0001.tif
Planet: 990000837284 Planet: 990000837284

We hope, this helps. In case the error occurred, then please provide us your system environment details, e.g.

  • Operating System name, edition and 32 & 64 bit (e.g. Windows 7 Ultimate 64 bit)
  • Visual Studio, edition and other details?
  • Local language and settings etc?
  • .NET Framework version of your application project?
  • Any other information that you think is necessary.

It'll help us to be more specific.

Thank you Imran for response. I tested with your code some of them are reading incomplete.


For example
3drfuosi.xe1.tiff 990000857225,7225 and wihboij0.ked.tiff 9900,990000857231

We set to read both sides So it suppose to read complete bar codes.
First example read first part correct second part reads last 4 digits,
Second example reads first 4 digits and second part reads correct barcode.

OS Windows Prof 64bit
Visual Studio 2013
.Net 4.5

Hi Solomon,

Many thanks for writing back. Could you please provide both these files (3drfuosi.xe1.tiff) & (wihboij0.ked.tiff) for testing? Furthermore, you shared about reading both sides of the barcode so, could you please elaborate if you are trying to read the barcode by using different orientation angles? Your feedback will help us in better understanding your concerns and getting back to you with a solution so, kindly let us know.

We look forward to your feedback.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan