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

Free Support Forum - aspose.com

Random Letters from recognizition

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();

//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))
// break;


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

Thanks in advance.


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.


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.


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.

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

Dim lic As New Aspose.BarCodeRecognition.License

’ 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();


I Tried to save both as png and tif.


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,


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)
Console.WriteLine(“Read from file saved as stream :” & reader.GetCodeText())
reader = New BarCodeReader(“C:\temp\image.png”, BarCodeReadType.DataMatrix)
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.