Aspose::BarCode::BarCodeRecognition::BarCodeReader Class Reference

BarCodeReader encapsulates an image which may contain one or several barcodes, it then can perform ReadBarCodes operation to detect barcodes. More...

Inherits System::IDisposable.

Public Member Functions

int32_t get_Timeout ()
 Gets the timeout of recognition process in milliseconds. More...
 
void set_Timeout (int32_t value)
 Sets the timeout of recognition process in milliseconds. More...
 
System::ArrayPtr< System::SharedPtr< BarCodeResult > > get_FoundBarCodes ()
 Gets recognized BarCodeResults array More...
 
int32_t get_FoundCount ()
 Gets recognized barcodes count More...
 
System::SharedPtr< Aspose::BarCode::BarCodeRecognition::QualitySettingsget_QualitySettings ()
 QualitySettings allows to configure recognition quality and speed manually. You can quickly set up QualitySettings by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of QualitySettings is NormalQuality. More...
 
void set_QualitySettings (System::SharedPtr< Aspose::BarCode::BarCodeRecognition::QualitySettings > value)
 QualitySettings allows to configure recognition quality and speed manually. You can quickly set up QualitySettings by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of QualitySettings is NormalQuality. More...
 
System::SharedPtr< Aspose::BarCode::BarCodeRecognition::BarcodeSettingsget_BarcodeSettings ()
 The main BarCode decoding parameters. Contains parameters which make influence on recognized data. More...
 
void Abort ()
 Function requests termination of current recognition session from other thread. Abort is unblockable method and returns control just after calling. The method should be used when recognition process is too long. More...
 
System::ArrayPtr< System::SharedPtr< BarCodeResult > > ReadBarCodes ()
 Reads BarCodeResults from the image. More...
 
 BarCodeReader ()
 Initializes a new instance of the BarCodeReader class with default values. Requires to set image (SetBitmapImage()) before to call ReadBarCodes() method. More...
 
void SetBarCodeImage (System::SharedPtr< System::Drawing::Bitmap > value)
 Sets bitmap image for recognition. Must be called before ReadBarCodes() method. More...
 
void SetBarCodeImage (System::SharedPtr< System::Drawing::Bitmap > value, System::ArrayPtr< System::Drawing::Rectangle > areas)
 Sets bitmap image and areas for recognition. Must be called before ReadBarCodes() method. More...
 
void SetBarCodeImage (System::SharedPtr< System::Drawing::Bitmap > value, System::Drawing::Rectangle area)
 Sets bitmap image and area for recognition. Must be called before ReadBarCodes() method. More...
 
void SetBarCodeImage (System::String filename)
 Sets image file for recognition. Must be called before ReadBarCodes() method. More...
 
void SetBarCodeImage (System::SharedPtr< System::IO::Stream > stream)
 Sets image stream for recognition. Must be called before ReadBarCodes() method. More...
 
void SetBarCodeReadType (const System::ArrayPtr< System::SharedPtr< SingleDecodeType >> &barcodeTypes)
 Sets SingleDecodeType type array for recognition. Must be called before ReadBarCodes() method. More...
 
void SetBarCodeReadType (System::SharedPtr< BaseDecodeType > type)
 Sets decode type for recognition. Must be called before ReadBarCodes() method. More...
 
 BarCodeReader (System::SharedPtr< System::Drawing::Bitmap > image)
 Initializes a new instance of the BarCodeReader class from an image. More...
 
 BarCodeReader (System::SharedPtr< System::Drawing::Bitmap > image, const System::ArrayPtr< System::SharedPtr< BaseDecodeType >> &decodeTypes)
 Initializes a new instance of the BarCodeReader class. More...
 
 BarCodeReader (System::SharedPtr< System::Drawing::Bitmap > image, System::SharedPtr< BaseDecodeType > type)
 Initializes a new instance of the BarCodeReader class. More...
 
 BarCodeReader (System::SharedPtr< System::Drawing::Bitmap > image, System::Drawing::Rectangle area, const System::ArrayPtr< System::SharedPtr< BaseDecodeType >> &decodeTypes)
 Initializes a new instance of the BarCodeReader class. More...
 
 BarCodeReader (System::SharedPtr< System::Drawing::Bitmap > image, System::Drawing::Rectangle area, System::SharedPtr< BaseDecodeType > type)
 Initializes a new instance of the BarCodeReader class. More...
 
 BarCodeReader (System::SharedPtr< System::Drawing::Bitmap > image, System::ArrayPtr< System::Drawing::Rectangle > areas, const System::ArrayPtr< System::SharedPtr< BaseDecodeType >> &decodeTypes)
 Initializes a new instance of the BarCodeReader class. More...
 
 BarCodeReader (System::SharedPtr< System::Drawing::Bitmap > image, System::ArrayPtr< System::Drawing::Rectangle > areas, System::SharedPtr< BaseDecodeType > type)
 Initializes a new instance of the BarCodeReader class. More...
 
 BarCodeReader (System::String filename)
 Initializes a new instance of the BarCodeReader class from file. More...
 
 BarCodeReader (System::String filename, const System::ArrayPtr< System::SharedPtr< BaseDecodeType >> &decodeTypes)
 Initializes a new instance of the BarCodeReader class. More...
 
 BarCodeReader (System::String filename, System::SharedPtr< BaseDecodeType > type)
 Initializes a new instance of the BarCodeReader class. More...
 
 BarCodeReader (System::SharedPtr< System::IO::Stream > stream)
 Initializes a new instance of the BarCodeReader class. More...
 
 BarCodeReader (System::SharedPtr< System::IO::Stream > stream, System::SharedPtr< BaseDecodeType > type)
 Initializes a new instance of the BarCodeReader class. More...
 
 BarCodeReader (System::SharedPtr< System::IO::Stream > stream, const System::ArrayPtr< System::SharedPtr< BaseDecodeType >> &decodeTypes)
 Initializes a new instance of the BarCodeReader class. More...
 
void Dispose () override
 Release resource More...
 
bool ExportToXml (System::String xmlFile)
 Exports BarCode properties to the xml-file specified More...
 
bool ExportToXml (System::SharedPtr< System::IO::Stream > xmlStream)
 Exports BarCode properties to the xml-stream specified More...
 
- Public Member Functions inherited from System::Object
ASPOSECPP_SHARED_API Object ()
 Creates object. Initializes all internal data structures. More...
 
virtual ASPOSECPP_SHARED_API ~Object ()
 Destroys object. Frees all internal data structures. More...
 
ASPOSECPP_SHARED_API Object (Object const &x)
 Copy constructor. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
Objectoperator= (Object const &x)
 Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
ObjectSharedRefAdded ()
 Increments shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int SharedRefRemovedSafe ()
 Decrements and returns shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int RemovedSharedRefs (int count)
 Decreases shared reference count by specified value. More...
 
Detail::SmartPtrCounter * WeakRefAdded ()
 Increments weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
void WeakRefRemoved ()
 Decrements weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
Detail::SmartPtrCounter * GetCounter ()
 Gets reference counter data structure associated with the object. More...
 
int SharedCount () const
 Gets current value of shared reference counter. More...
 
ASPOSECPP_SHARED_API void Lock ()
 Implements C# lock() statement locking. Call directly or use LockContext sentry object. More...
 
ASPOSECPP_SHARED_API void Unlock ()
 Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More...
 
virtual ASPOSECPP_SHARED_API bool Equals (ptr obj)
 Compares objects using C# Object.Equals semantics. More...
 
virtual ASPOSECPP_SHARED_API int32_t GetHashCode () const
 Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. More...
 
virtual ASPOSECPP_SHARED_API String ToString () const
 Analog of C# Object.ToString() method. Enables converting custom objects to string. More...
 
virtual ASPOSECPP_SHARED_API ptr MemberwiseClone () const
 Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More...
 
virtual ASPOSECPP_SHARED_API const TypeInfoGetType () const
 Gets actual type of object. Analog of C# System.Object.GetType() call. More...
 
virtual ASPOSECPP_SHARED_API bool Is (const TypeInfo &targetType) const
 Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More...
 
virtual ASPOSECPP_SHARED_API void SetTemplateWeakPtr (uint32_t argument)
 Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. More...
 
virtual ASPOSECPP_SHARED_API bool FastCast (const Details::FastRttiBase &helper, void **out_ptr) const
 For internal purposes only. More...
 
template<>
bool Equals (float const &objA, float const &objB)
 
template<>
bool Equals (double const &objA, double const &objB)
 
template<>
bool ReferenceEquals (String const &str, std::nullptr_t)
 
template<>
bool ReferenceEquals (String const &str1, String const &str2)
 

Static Public Member Functions

static System::SharedPtr< Aspose::BarCode::Common::ProcessorSettingsget_ProcessorSettings ()
 Gets a settings of using processor cores. More...
 
static System::SharedPtr< BarCodeReaderImportFromXml (System::String xmlFile)
 Imports BarCode properties from the xml-file specified and applies them to the current BarCodeReader instance. More...
 
static System::SharedPtr< BarCodeReaderImportFromXml (System::SharedPtr< System::IO::Stream > xmlStream)
 Imports BarCode properties from the xml-stream specified and applies them to the current BarCodeReader instance. More...
 
- Static Public Member Functions inherited from System::Object
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 Reference-compares value type object with nullptr. More...
 
template<typename T1 , typename T2 >
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares reference type objects in C# style. More...
 
template<typename T1 , typename T2 >
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares value type objects in C# style. More...
 
static const TypeInfoType ()
 Implements C# typeof(System.Object) construct. More...
 

Additional Inherited Members

- Public Types inherited from System::Object
typedef SmartPtr< Objectptr
 Alias for smart pointer type. More...
 

Detailed Description

BarCodeReader encapsulates an image which may contain one or several barcodes, it then can perform ReadBarCodes operation to detect barcodes.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39Standard, DecodeType.Code128))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39Standard, DecodeType.Code128)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using

Constructor & Destructor Documentation

◆ BarCodeReader() [1/14]

Aspose::BarCode::BarCodeRecognition::BarCodeReader::BarCodeReader ( )

Initializes a new instance of the BarCodeReader class with default values. Requires to set image (SetBitmapImage()) before to call ReadBarCodes() method.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (BarCodeReader reader = new BarCodeReader())
{
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128);
reader.SetBarCodeImage(@"c:\test.png");
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using reader As New BarCodeReader()
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128)
reader.SetBarCodeImage("c:\test.png")
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using

◆ BarCodeReader() [2/14]

Aspose::BarCode::BarCodeRecognition::BarCodeReader::BarCodeReader ( System::SharedPtr< System::Drawing::Bitmap image)

Initializes a new instance of the BarCodeReader class from an image.

Parameters
imageA Bitmap instance containing the image

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader(bmp))
{
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128);
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
Using reader As New BarCodeReader(bmp)
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
End Using

◆ BarCodeReader() [3/14]

Aspose::BarCode::BarCodeRecognition::BarCodeReader::BarCodeReader ( System::SharedPtr< System::Drawing::Bitmap image,
const System::ArrayPtr< System::SharedPtr< BaseDecodeType >> &  decodeTypes 
)

Initializes a new instance of the BarCodeReader class.

Parameters
imageThe image.
decodeTypesDecode types.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader(bmp, DecodeType.Code39Standard, DecodeType.Code128))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
Using reader As New BarCodeReader(bmp, DecodeType.Code39Standard, DecodeType.Code128)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
End Using

◆ BarCodeReader() [4/14]

Aspose::BarCode::BarCodeRecognition::BarCodeReader::BarCodeReader ( System::SharedPtr< System::Drawing::Bitmap image,
System::SharedPtr< BaseDecodeType type 
)

Initializes a new instance of the BarCodeReader class.

Parameters
imageThe image.
typeThe decode type1. It can be single or multy

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader(bmp, new MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
Using reader As New BarCodeReader(bmp, New MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
End Using

◆ BarCodeReader() [5/14]

Aspose::BarCode::BarCodeRecognition::BarCodeReader::BarCodeReader ( System::SharedPtr< System::Drawing::Bitmap image,
System::Drawing::Rectangle  area,
const System::ArrayPtr< System::SharedPtr< BaseDecodeType >> &  decodeTypes 
)

Initializes a new instance of the BarCodeReader class.

Parameters
imageThe image.
areaThe area for recognition.
decodeTypesDecode types.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height), DecodeType.Code39Standard, DecodeType.Code128)
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
Using reader As New BarCodeReader(bmp, New Rectangle(0, 0, bmp.Width, bmp.Height), DecodeType.Code39Standard, DecodeType.Code128)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
End Using

◆ BarCodeReader() [6/14]

Aspose::BarCode::BarCodeRecognition::BarCodeReader::BarCodeReader ( System::SharedPtr< System::Drawing::Bitmap image,
System::Drawing::Rectangle  area,
System::SharedPtr< BaseDecodeType type 
)

Initializes a new instance of the BarCodeReader class.

Parameters
imageThe image.
areaThe area for recognition.
typeThe decode type.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height), new MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
Using reader As New BarCodeReader(bmp, New Rectangle(0, 0, bmp.Width, bmp.Height), New MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
End Using

◆ BarCodeReader() [7/14]

Aspose::BarCode::BarCodeRecognition::BarCodeReader::BarCodeReader ( System::SharedPtr< System::Drawing::Bitmap image,
System::ArrayPtr< System::Drawing::Rectangle areas,
const System::ArrayPtr< System::SharedPtr< BaseDecodeType >> &  decodeTypes 
)

Initializes a new instance of the BarCodeReader class.

Parameters
imageThe image to read
areasThe array of recognition areas
decodeTypesThe decode types applicable for all the areas specified.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader(bmp, new Rectangle[] { new Rectangle(0, 0, bmp.Width, bmp.Height) }, DecodeType.Code39Standard, DecodeType.Code128)
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
Using reader As New BarCodeReader(bmp, New Rectangle() {New Rectangle(0, 0, bmp.Width, bmp.Height)}, DecodeType.Code39Standard, DecodeType.Code128)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
End Using
End Using

◆ BarCodeReader() [8/14]

Aspose::BarCode::BarCodeRecognition::BarCodeReader::BarCodeReader ( System::SharedPtr< System::Drawing::Bitmap image,
System::ArrayPtr< System::Drawing::Rectangle areas,
System::SharedPtr< BaseDecodeType type 
)

Initializes a new instance of the BarCodeReader class.

Parameters
imageThe image to read
areasThe array of recognition areas
typeThe decode type applicable for all the areas specified.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader(bmp, new Rectangle[] { new Rectangle(0, 0, bmp.Width, bmp.Height) }, new MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
Using reader As New BarCodeReader(bmp, New Rectangle() {New Rectangle(0, 0, bmp.Width, bmp.Height)}, New MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
End Using
End Using

◆ BarCodeReader() [9/14]

Aspose::BarCode::BarCodeRecognition::BarCodeReader::BarCodeReader ( System::String  filename)

Initializes a new instance of the BarCodeReader class from file.

Parameters
filenameThe filename.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png"))
{
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128);
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using reader As New BarCodeReader("c:\test.png")
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using

◆ BarCodeReader() [10/14]

Aspose::BarCode::BarCodeRecognition::BarCodeReader::BarCodeReader ( System::String  filename,
const System::ArrayPtr< System::SharedPtr< BaseDecodeType >> &  decodeTypes 
)

Initializes a new instance of the BarCodeReader class.

Parameters
filenameThe filename.
decodeTypesDecode types.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39Standard, DecodeType.Code128))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39Standard, DecodeType.Code128)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using

◆ BarCodeReader() [11/14]

Aspose::BarCode::BarCodeRecognition::BarCodeReader::BarCodeReader ( System::String  filename,
System::SharedPtr< BaseDecodeType type 
)

Initializes a new instance of the BarCodeReader class.

Parameters
filenameThe filename.
typeThe decode type.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", new MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128)))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using reader As New BarCodeReader("c:\test.png", New MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using

◆ BarCodeReader() [12/14]

Aspose::BarCode::BarCodeRecognition::BarCodeReader::BarCodeReader ( System::SharedPtr< System::IO::Stream stream)

Initializes a new instance of the BarCodeReader class.

Parameters
streamThe stream.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (FileStream fstr = new FileStream(@"c:\test.png", FileMode.Open))
using (BarCodeReader reader = new BarCodeReader(fstr))
{
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128);
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using fstr = New FileStream("c:\test.png", FileMode.Open)
Using reader As New BarCodeReader(fstr)
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
End Using

◆ BarCodeReader() [13/14]

Aspose::BarCode::BarCodeRecognition::BarCodeReader::BarCodeReader ( System::SharedPtr< System::IO::Stream stream,
System::SharedPtr< BaseDecodeType type 
)

Initializes a new instance of the BarCodeReader class.

Parameters
streamThe stream.
typeThe decode type.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (FileStream fstr = new FileStream(@"c:\test.png", FileMode.Open))
using (BarCodeReader reader = new BarCodeReader(fstr, new MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128)))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using fstr = New FileStream("c:\test.png", FileMode.Open)
Using reader As New BarCodeReader(fstr, New MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
End Using

◆ BarCodeReader() [14/14]

Aspose::BarCode::BarCodeRecognition::BarCodeReader::BarCodeReader ( System::SharedPtr< System::IO::Stream stream,
const System::ArrayPtr< System::SharedPtr< BaseDecodeType >> &  decodeTypes 
)

Initializes a new instance of the BarCodeReader class.

Parameters
streamThe stream.
decodeTypesDecode types.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (FileStream fstr = new FileStream(@"c:\test.png", FileMode.Open))
using (BarCodeReader reader = new BarCodeReader(fstr, DecodeType.Code39Standard, DecodeType.Code128))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using fstr = New FileStream("c:\test.png", FileMode.Open)
Using reader As New BarCodeReader(fstr, DecodeType.Code39Standard, DecodeType.Code128)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
End Using

Member Function Documentation

◆ Abort()

void Aspose::BarCode::BarCodeRecognition::BarCodeReader::Abort ( )

Function requests termination of current recognition session from other thread. Abort is unblockable method and returns control just after calling. The method should be used when recognition process is too long.

This sample shows how to call Abort function from other thread

[C#]
private static void ThreadRecognize(object readerObj)
{
BarCodeReader reader = (BarCodeReader)readerObj;
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeType);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39Standard, DecodeType.Code128);
Thread thread1 = new Thread(ThreadRecognize);
thread1.Start(reader);
Thread.Sleep(100);
reader.Abort();
[VB.NET]
Private Shared Sub ThreadRecognize(readerObj As Object)
Dim reader As BarCodeReader = readerObj
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
End Sub
Dim reader As New BarCodeReader("c:\test.png", DecodeType.Code39Standard, DecodeType.Code128)
Dim thread1 As New Thread(AddressOf ThreadRecognize)
thread1.Start(reader)
Thread.Sleep(100)
reader.Abort()

◆ Dispose()

void Aspose::BarCode::BarCodeRecognition::BarCodeReader::Dispose ( )
overridevirtual

Release resource

Reimplemented from System::IDisposable.

◆ ExportToXml() [1/2]

bool Aspose::BarCode::BarCodeRecognition::BarCodeReader::ExportToXml ( System::String  xmlFile)

Exports BarCode properties to the xml-file specified

Parameters
xmlFileThe name for the file
Returns

Whether or not export completed successfully.

Returns True in case of success; False Otherwise

◆ ExportToXml() [2/2]

bool Aspose::BarCode::BarCodeRecognition::BarCodeReader::ExportToXml ( System::SharedPtr< System::IO::Stream xmlStream)

Exports BarCode properties to the xml-stream specified

Parameters
xmlStreamThe xml-stream for saving
Returns

Whether or not export completed successfully.

Returns True in case of success; False Otherwise

◆ get_BarcodeSettings()

System::SharedPtr<Aspose::BarCode::BarCodeRecognition::BarcodeSettings> Aspose::BarCode::BarCodeRecognition::BarCodeReader::get_BarcodeSettings ( )

The main BarCode decoding parameters. Contains parameters which make influence on recognized data.

The main BarCode decoding parameters

◆ get_FoundBarCodes()

System::ArrayPtr<System::SharedPtr<BarCodeResult> > Aspose::BarCode::BarCodeRecognition::BarCodeReader::get_FoundBarCodes ( )

Gets recognized BarCodeResults array

The recognized BarCodeResults array

This sample shows how to read barcodes with BarCodeReader

[C#]
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39Standard, DecodeType.Code128))
{
reader.ReadBarCodes();
for(int i = 0; reader.FoundCount > i; ++i)
Console.WriteLine("BarCode CodeText: " + reader.FoundBarCodes[i].CodeText);
}
[VB.NET]
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39Standard, DecodeType.Code128)
reader.ReadBarCodes()
For i As Integer = 0 To reader.FoundCount - 1 Step 1
Console.WriteLine("BarCode CodeText: " + reader.FoundBarCodes(i).CodeText)
Next
End Using

◆ get_FoundCount()

int32_t Aspose::BarCode::BarCodeRecognition::BarCodeReader::get_FoundCount ( )

Gets recognized barcodes count

The recognized barcodes count


This sample shows how to read barcodes with BarCodeReader

[C#]
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39Standard, DecodeType.Code128))
{
reader.ReadBarCodes();
for(int i = 0; reader.FoundCount > i; ++i)
Console.WriteLine("BarCode CodeText: " + reader.FoundBarCodes[i].CodeText);
}
[VB.NET]
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39Standard, DecodeType.Code128)
reader.ReadBarCodes()
For i As Integer = 0 To reader.FoundCount - 1 Step 1
Console.WriteLine("BarCode CodeText: " + reader.FoundBarCodes(i).CodeText)
Next
End Using

◆ get_ProcessorSettings()

static System::SharedPtr<Aspose::BarCode::Common::ProcessorSettings> Aspose::BarCode::BarCodeRecognition::BarCodeReader::get_ProcessorSettings ( )
static

Gets a settings of using processor cores.

This sample shows how to use ProcessorSettings to add maximum multi-threaded performnce

[C#]
//this allows to use all cores for single BarCodeReader call
BarCodeReader.ProcessorSettings.UseAllCores = true;
//this allows to use current count of cores
BarCodeReader.ProcessorSettings.UseAllCores = false;
BarCodeReader.ProcessorSettings.UseOnlyThisCoresCount = Math.Max(1, Environment.ProcessorCount / 2);
[VB.NET]
'this allows to use all cores for single BarCodeReader call
BarCodeReader.ProcessorSettings.UseAllCores = True
'this allows to use current count of cores
BarCodeReader.ProcessorSettings.UseAllCores = False
BarCodeReader.ProcessorSettings.UseOnlyThisCoresCount = Math.Max(1, Environment.ProcessorCount / 2)

◆ get_QualitySettings()

System::SharedPtr<Aspose::BarCode::BarCodeRecognition::QualitySettings> Aspose::BarCode::BarCodeRecognition::BarCodeReader::get_QualitySettings ( )

QualitySettings allows to configure recognition quality and speed manually. You can quickly set up QualitySettings by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of QualitySettings is NormalQuality.

QualitySettings to configure recognition quality and speed.

This sample shows how to use QualitySettings with BarCodeReader

[C#]
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39Standard, DecodeType.Code128))
{
//set high performance mode
reader.QualitySettings = QualitySettings.HighPerformance;
foreach (BarCodeResult result in reader.ReadBarCodes())
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39Standard, DecodeType.Code128))
{
//normal quality mode is set by default
foreach (BarCodeResult result in reader.ReadBarCodes())
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39Standard, DecodeType.Code128))
{
//set high performance mode
reader.QualitySettings = QualitySettings.HighPerformance;
//set separate options
reader.QualitySettings.AllowMedianSmoothing = true;
reader.QualitySettings.MedianSmoothingWindowSize = 5;
foreach (BarCodeResult result in reader.ReadBarCodes())
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
[VB.NET]
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39Standard, DecodeType.Code128)
'set high performance mode
reader.QualitySettings = QualitySettings.HighPerformance
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Next
End Using
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39Standard, DecodeType.Code128)
'normal quality mode is set by default
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
End Using
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39Standard, DecodeType.Code128)
'set high performance mode
reader.QualitySettings = QualitySettings.HighPerformance
'set separate options
reader.QualitySettings.AllowMedianSmoothing = True
reader.QualitySettings.MedianSmoothingWindowSize = 5
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
End Using

◆ get_Timeout()

int32_t Aspose::BarCode::BarCodeRecognition::BarCodeReader::get_Timeout ( )

Gets the timeout of recognition process in milliseconds.

The timeout.

This sample shows how to avoid recogntion hungs with timeount on large images

[C#]
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png"))
{
reader.Timeout = 5000;
foreach (BarCodeResult result in reader.ReadBarCodes())
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
[VB.NET]
Using reader As New BarCodeReader("c:\test.png")
reader.Timeout = 5000
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using

◆ ImportFromXml() [1/2]

static System::SharedPtr<BarCodeReader> Aspose::BarCode::BarCodeRecognition::BarCodeReader::ImportFromXml ( System::String  xmlFile)
static

Imports BarCode properties from the xml-file specified and applies them to the current BarCodeReader instance.

Parameters
xmlFileThe name for the file
Returns

Returns True in case of success;

False Otherwise

◆ ImportFromXml() [2/2]

static System::SharedPtr<BarCodeReader> Aspose::BarCode::BarCodeRecognition::BarCodeReader::ImportFromXml ( System::SharedPtr< System::IO::Stream xmlStream)
static

Imports BarCode properties from the xml-stream specified and applies them to the current BarCodeReader instance.

Parameters
xmlStreamThe xml-stream for loading
Returns

Returns True in case of success;

False Otherwise

◆ ReadBarCodes()

System::ArrayPtr<System::SharedPtr<BarCodeResult> > Aspose::BarCode::BarCodeRecognition::BarCodeReader::ReadBarCodes ( )

Reads BarCodeResults from the image.

This sample shows how to read barcodes with BarCodeReader

[C#]
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39Standard, DecodeType.Code128))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39Standard, DecodeType.Code128))
{
reader.ReadBarCodes();
for(int i = 0; reader.FoundCount > i; ++i)
Console.WriteLine("BarCode CodeText: " + reader.FoundBarCodes[i].CodeText);
}
[VB.NET]
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39Standard, DecodeType.Code128)
reader.ReadBarCodes()
For i As Integer = 0 To reader.FoundCount - 1 Step 1
Console.WriteLine("BarCode CodeText: " + reader.FoundBarCodes(i).CodeText)
Next
End Using
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39Standard, DecodeType.Code128)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
Returns
Returns array of recognized BarCodeResults on the image. If nothing is recognized, zero array is returned.

◆ set_QualitySettings()

void Aspose::BarCode::BarCodeRecognition::BarCodeReader::set_QualitySettings ( System::SharedPtr< Aspose::BarCode::BarCodeRecognition::QualitySettings value)

QualitySettings allows to configure recognition quality and speed manually. You can quickly set up QualitySettings by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of QualitySettings is NormalQuality.

QualitySettings to configure recognition quality and speed.

This sample shows how to use QualitySettings with BarCodeReader

[C#]
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39Standard, DecodeType.Code128))
{
//set high performance mode
reader.QualitySettings = QualitySettings.HighPerformance;
foreach (BarCodeResult result in reader.ReadBarCodes())
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39Standard, DecodeType.Code128))
{
//normal quality mode is set by default
foreach (BarCodeResult result in reader.ReadBarCodes())
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.Code39Standard, DecodeType.Code128))
{
//set high performance mode
reader.QualitySettings = QualitySettings.HighPerformance;
//set separate options
reader.QualitySettings.AllowMedianSmoothing = true;
reader.QualitySettings.MedianSmoothingWindowSize = 5;
foreach (BarCodeResult result in reader.ReadBarCodes())
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
[VB.NET]
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39Standard, DecodeType.Code128)
'set high performance mode
reader.QualitySettings = QualitySettings.HighPerformance
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Next
End Using
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39Standard, DecodeType.Code128)
'normal quality mode is set by default
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
End Using
Using reader As New BarCodeReader("c:\test.png", DecodeType.Code39Standard, DecodeType.Code128)
'set high performance mode
reader.QualitySettings = QualitySettings.HighPerformance
'set separate options
reader.QualitySettings.AllowMedianSmoothing = True
reader.QualitySettings.MedianSmoothingWindowSize = 5
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
End Using

◆ set_Timeout()

void Aspose::BarCode::BarCodeRecognition::BarCodeReader::set_Timeout ( int32_t  value)

Sets the timeout of recognition process in milliseconds.

The timeout.

This sample shows how to avoid recogntion hungs with timeount on large images

[C#]
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png"))
{
reader.Timeout = 5000;
foreach (BarCodeResult result in reader.ReadBarCodes())
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
[VB.NET]
Using reader As New BarCodeReader("c:\test.png")
reader.Timeout = 5000
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using

◆ SetBarCodeImage() [1/5]

void Aspose::BarCode::BarCodeRecognition::BarCodeReader::SetBarCodeImage ( System::SharedPtr< System::Drawing::Bitmap value)

Sets bitmap image for recognition. Must be called before ReadBarCodes() method.

Parameters
valueThe bitmap image for recognition.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader())
{
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128);
reader.SetBarCodeImage(bmp);
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
Using reader As New BarCodeReader()
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128)
reader.SetBarCodeImage(bmp)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
End Using

◆ SetBarCodeImage() [2/5]

void Aspose::BarCode::BarCodeRecognition::BarCodeReader::SetBarCodeImage ( System::SharedPtr< System::Drawing::Bitmap value,
System::ArrayPtr< System::Drawing::Rectangle areas 
)

Sets bitmap image and areas for recognition. Must be called before ReadBarCodes() method.

Parameters
valueThe bitmap image for recognition.
areasareas list for recognition

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader())
{
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128);
reader.SetBarCodeImage(bmp, new Rectangle[] { new Rectangle(0, 0, bmp.Width, bmp.Height) });
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
Using reader As New BarCodeReader()
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128)
reader.SetBarCodeImage(bmp, New Rectangle() {New Rectangle(0, 0, bmp.Width, bmp.Height)})
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
End Using
End Using

◆ SetBarCodeImage() [3/5]

void Aspose::BarCode::BarCodeRecognition::BarCodeReader::SetBarCodeImage ( System::SharedPtr< System::Drawing::Bitmap value,
System::Drawing::Rectangle  area 
)

Sets bitmap image and area for recognition. Must be called before ReadBarCodes() method.

Parameters
valueThe bitmap image for recognition.
areaarea for recognition

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (Bitmap bmp = new Bitmap(@"c:\test.png"))
using (BarCodeReader reader = new BarCodeReader())
{
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128);
reader.SetBarCodeImage(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using bmp = New Bitmap("c:\test.png")
Using reader As New BarCodeReader()
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128)
reader.SetBarCodeImage(bmp, New Rectangle(0, 0, bmp.Width, bmp.Height))
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
End Using

◆ SetBarCodeImage() [4/5]

void Aspose::BarCode::BarCodeRecognition::BarCodeReader::SetBarCodeImage ( System::String  filename)

Sets image file for recognition. Must be called before ReadBarCodes() method.

Parameters
filenameThe image file for recogniton.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (BarCodeReader reader = new BarCodeReader())
{
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128);
reader.SetBarCodeImage(@"c:\test.png");
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using reader As New BarCodeReader()
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128)
reader.SetBarCodeImage("c:\test.png")
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using

◆ SetBarCodeImage() [5/5]

void Aspose::BarCode::BarCodeRecognition::BarCodeReader::SetBarCodeImage ( System::SharedPtr< System::IO::Stream stream)

Sets image stream for recognition. Must be called before ReadBarCodes() method.

Parameters
streamThe image stream for recogniton.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (FileStream fstr = new FileStream(@"c:\test.png", FileMode.Open))
using (BarCodeReader reader = new BarCodeReader())
{
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128);
reader.SetBarCodeImage(fstr);
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using fstr = New FileStream("c:\test.png", FileMode.Open)
Using reader As New BarCodeReader()
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128)
reader.SetBarCodeImage(fstr)
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using
End Using

◆ SetBarCodeReadType() [1/2]

void Aspose::BarCode::BarCodeRecognition::BarCodeReader::SetBarCodeReadType ( const System::ArrayPtr< System::SharedPtr< SingleDecodeType >> &  barcodeTypes)

Sets SingleDecodeType type array for recognition. Must be called before ReadBarCodes() method.

Parameters
barcodeTypesThe SingleDecodeType type array to read.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (BarCodeReader reader = new BarCodeReader())
{
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128);
reader.SetBarCodeImage(@"c:\test.png");
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using reader As New BarCodeReader()
reader.SetBarCodeReadType(DecodeType.Code39Standard, DecodeType.Code128)
reader.SetBarCodeImage("c:\test.png")
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using

◆ SetBarCodeReadType() [2/2]

void Aspose::BarCode::BarCodeRecognition::BarCodeReader::SetBarCodeReadType ( System::SharedPtr< BaseDecodeType type)

Sets decode type for recognition. Must be called before ReadBarCodes() method.

Parameters
typeThe type of barcode to read.

This sample shows how to detect Code39 and Code128 barcodes.

[C#]
using (BarCodeReader reader = new BarCodeReader())
{
reader.SetBarCodeReadType(new MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128));
reader.SetBarCodeImage(@"c:\test.png");
foreach (BarCodeResult result in reader.ReadBarCodes())
{
Console.WriteLine("BarCode Type: " + result.CodeTypeName);
Console.WriteLine("BarCode CodeText: " + result.CodeText);
}
}
[VB.NET]
Using reader As New BarCodeReader()
reader.SetBarCodeReadType(New MultyDecodeType(DecodeType.Code39Standard, DecodeType.Code128))
reader.SetBarCodeImage("c:\test.png")
For Each result As BarCodeResult In reader.ReadBarCodes()
Console.WriteLine("BarCode Type: " + result.CodeTypeName)
Console.WriteLine("BarCode CodeText: " + result.CodeText)
Next
End Using