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

Free Support Forum - aspose.com

Random Letters from recognizition

Hello,
I’ve generated Barcode using ASPOSE and inserted into document file. Then I took print out of the same and faxed it as tiff and tried to read with BarcodeReader class(4.3.0 version). The reader is giving some ambiguous characters. With the newer versions of the dll I am just getting blank .

Below is my code if you want to look at.

var img = Image.FromFile(destFileName);
Guid guid = img.FrameDimensionsList[0];
FrameDimension dimension = new FrameDimension(guid);
int totalFrame = img.GetFrameCount(dimension);

var lic = new Aspose.BarCodeRecognition.License();
lic.SetLicense(“Aspose.BarCode.lic”);

//Feed the pages to BarCodeReader one by one
var rd = new BarCodeReader(new Bitmap(img));

for (int i = 0; i < totalFrame; i++)
{
img.SelectActiveFrame(dimension, i);
while (rd.Read())
{
barCodeText = rd.GetCodeText();
if (!string.IsNullOrEmpty(barCodeText))
{
MessageBox.Show(barCodeText);
// break;
}
}
}

rd.Close();

Can you please help me in this. I’ve used DataMatrix to generate the barcode.

Thanks in advance.

Hi,


Thank you for your inquiry.

It would be of great help to us, if you please share the sample document for our review.

Looking forward to your response.

Please find the attached test file that I am using.

Hi,


Thank you for providing the sample file. I have tried scanning barcode from the image using the latest version of Aspose.BarCode for .NET v4.5.0.1 and I was able to extract the CodeText as “42=/35098_”. Can you please confirm the correct text that your are expecting?

The original text was 1942843835092730.
The barcode was generated using Aspose.BarCode symbology type DataMatrix.

Hi,


Thank you for your response.

The incorrect CodeText can be due to the poor image quality of the barcode. For further investigation in this regard, can you please share your sample code to generate the barcode?

Thanks in advance.

Hello,
Thanks for your reply.
Below is the code.

Dim builder As New BarCodeBuilder

’ set the symbology type
builder.SymbologyType = Symbology.DataMatrix

’ Set the license file for Aspose.Barcode
Dim license As New Aspose.BarCode.License
license.SetLicense(“Aspose.BarCode.lic”)

Dim lic As New Aspose.BarCodeRecognition.License
lic.SetLicense(“Aspose.BarCode.lic”)

’ set the codetext
builder.CodeText = myTempVal
'Create A Memory Stream Object that Would store barcode image in binary form

Dim mStream As New System.IO.MemoryStream
builder.BarCodeImage.Save(mStream, System.Drawing.Imaging.ImageFormat.Png)

var img = builder.GenerateBarCodeImage();

img.Save(@“C:\BarCodeTest\MyTest.png”);

I Tried to save both as png and tif.

Hi,


Thank you for sharing your source code.

I am afraid that I am unable to replicate the said issue with latest version of Aspose.BarCode for .NET v4.5.0.1. Below is my source code for your reference,

VB.NET

Dim stream = New System.IO.MemoryStream()
Dim builder = New BarCodeBuilder()
builder.CodeText = “1942843835092730”
Console.WriteLine(“Encoded Text :” & builder.CodeText)
builder.SymbologyType = Symbology.DataMatrix
builder.Save(stream, ImageFormat.Png)
builder.BarCodeImage.Save(“C:\temp\image.png”, ImageFormat.Png)


Dim reader = New BarCodeReader(stream, BarCodeReadType.DataMatrix)
reader.Read()
Console.WriteLine(“Read from file saved as stream :” & reader.GetCodeText())
reader = New BarCodeReader(“C:\temp\image.png”, BarCodeReadType.DataMatrix)
reader.Read()
Console.WriteLine(“Read from file saved as image :” & reader.GetCodeText())
The problem you are having is due the to the scanning and printing process that effects the image quality. You can give a try by scanning the document on some high resolution and then read the barcode from it.

Regards,