Free Support Forum - aspose.com

Unable to find class BarCodeReader in Apose.BarCode namespace

I am trying to upgrade Aspose.BarCode dll from version 2.1.0.38800 to 3.6.0.0

In v2.1, I was using Apose.BarCode.BarCodeReader to detect a barcode in the Bitmap but in version 3.6, I couldnt find that class in Apose.BarCode namespace

v2.1:
Aspose.BarCode.BarCodeReader reader = new Aspose.BarCode.BarCodeReader();

v 3.6:
(Solution ?)

Thanks,
Uday

Hi Uday,


Thank you for inquiry.

Following are the changes which needs to be done for upgrading from Aspose.BarCode for .NET 2.x to 3.x.
  • Add reference to the new dll for recognition. Aspose.BarCodeRecognition.dll
  • New namespace. Aspose.BarCodeRecognition
  • Symbology type can be set in constructor of BarCodeReader class (BarCodeReader.BarCodeReadType is no longer available)
  • BarCodeReader.Read() method now returns boolean value. Returns true, if barcode found, otherwise false. BarCodeInfo class is no longer available.
  • New method for getting symbology information for recognized barcode (BarCodeReader.GetReadType()). BarCodeInfo.BarCodeReadType property is no longer available.
  • New method for getting codetext of recognized barcode (BarCodeReader.GetCodeText()). BarCodeInfo.CodeText property is no longer available.
Old Code:
// set license for both barcode generation and recognition
Aspose.BarCode.License lic = new Aspose.BarCode.License();
lic.SetLicense(@“Aspose.Total.lic”);

// initialize the BarCodeReader
BarCodeReader reader = new BarCodeReader(“test.png”);
// set symbology type
reader.BarCodeReadType = BarCodeReadType.Code39Standard;
// get the information about all the detected barcodes
BarCodeInfo[] infos = reader.Read();
// display the detected barcode information in the loop
foreach (BarCodeInfo info in infos)
{
Console.WriteLine("Codetext: " + info.CodeText);
}

New Code:
// set license for barcode generation
Aspose.BarCode.License licGen = new Aspose.BarCode.License();
licGen.SetLicense(@“Aspose.Total.lic”);
// set license for barcode recognition
Aspose.BarCodeRecognition.License licRec = new Aspose.BarCodeRecognition.License();
licRec.SetLicense(@“Aspose.Total.lic”);

// initialize the reader
BarCodeReader reader = new BarCodeReader(“test.png”, BarCodeReadType.Code39Standard);
// read all the detected barcodes. Read() method returns bool now
while (reader.Read() == true)
{
// display the codetext
Console.WriteLine("Codetext: " + reader.GetCodeText();
}
// close the reader
reader.Close();

There are some new features available as well in 3.x versions. Please refer to http://www.aspose.com/documentation/.net-components/aspose.barcode-for-.net/working-with-barcode-recognition-1.html for details and code examples.

Thanks Razzaq for the answer but problem with my project is I am unable to file the namespace Asponse.BarCodeReader and Aspose.BarCodeRecognition.

Clipboard01.jpg shows the object browser for the DLL
I also attached project which may be helpful for your review.
Am I missing any DLL other than Aspose.BarCode.dll which I have to add?

Hi,


There are now 3 dlls shipped with the new versions in bin\netx.x folders where you installed Aspose.BarCode for .NET.
  1. Aspose.BarCode.dll - You already added reference. Contains BarCodeBuilder class
  2. Aspose.BarCodeRecognition.dll - Please add reference to this in your project. Contains BarCodeReader class
  3. Aspose.BarCode.WPF.dll - Contains barcode generation functions for use with WPF applications

Thanks for the help Razzaq.


Hello Razzaq,

Document ‘faxTest Doc.jpg’ contains a barcode which I am able to detect using old version dll but I dont get any results while using new version dll.



private void OldBarCode(Bitmap page)
{
// set license for barcode generation
Aspose.BarCode.License licGen = new Aspose.BarCode.License();
licGen.SetLicense(@“Aspose.BarCode.lic”);

// initialize the reader
using (BarCodeReader reader = new BarCodeReader(page))
{

//clear symbology
reader.SymbologyType = (Symbology)(0);
reader.SymbologyType |= Symbology.Code39Standard;
reader.SymbologyType |= Symbology.Pdf417;
reader.SymbologyType |= Symbology.Code128;
reader.SymbologyType |= Symbology.DataMatrix;

BarCodeInfo[] infos = reader.Read();
if (infos.Length > 0)
{
for (int index = 0; index < infos.Length; index++)
{
Response.Write("Codetext: " + infos[index].CodeText + “
”);
break;
}
}
}
}

private void NewBarCode(Bitmap page)
{
// set license for barcode generation
Aspose.BarCode.License licGen = new Aspose.BarCode.License();
licGen.SetLicense(@“Aspose.Total.lic”);
// set license for barcode recognition
Aspose.BarCodeRecognition.License licRec = new Aspose.BarCodeRecognition.License();
licRec.SetLicense(@“Aspose.Total.lic”);

// initialize the reader
using (BarCodeReader reader = new BarCodeReader(page, BarCodeReadType.Code39Standard))
{
while (reader.Read())
{
// display the codetext
Response.Write("Codetext: " + reader.GetCodeText());
}
}
}

Can you spot any difference between
NewBarCode and OldBarCode methods?
Do I add anything to detect the barcode?

Let me know if you need anything else.

Thanks,
Uday

I think I missed BarCodeReadType.Pdf417 in reader construct.

Thanks,

Hi there… I have an old license of your software, the latest version of Aspose.Barcode I can use is v3.0. I had been using the BarcodeReader class, but with this new upgrade (from v2.7 to v3.0) this class is gone. I’ve seen in documentation that starting with v3.0, there is now a BarcodeRecognition namespace, however I can’t find it. In my installation there was no Aspose.BarcodeRecognition.dll, only Aspose.Barcode. How do I install or find this library?


Thank you.

Hi,

Thank you for inquiry.

Please check the installation folder (default: C:\Program Files (x86)\Aspose\Aspose.BarCode\bin). You will find “Aspose.BarCodeRecognition.dll” in the respective sub-folder.

You also need to add a new references to this dll in your Visual Studio project.

Saqib,


I’ve been using your products for nearly 3 years now and am aware of where to find the dlls and that they need to be referenced in the project. The installation for Aspose.Barcode did not create this dll in the bin directory. I’ve attached the installation file to this post.

Thanks,
-Matt

Hello Matt,

Sorry, the attached MSI do not have the BarCodeRecognition.dll. Please find the dll files of 3.0 attached.

It is version 3.0, which is very old. If possible, please use the latest v4.2 with improvements and fixes.

Edit: Added the attachment.

Perfect, thank you so much Saqib!!