It's very simple to implement fast Aztec Code 2D barcode reading in C# and VB.NET programming projects. No additional barcode software or plug-ins should be used. As long as integrating PQScan.BarcodeScanner.dll into .NET project, you are capable of scanning and reading Aztec Code barcode from image files like Gif, Jpeg/Jpg, Bmp, Tiff/Tif, and Png. All these raster image file formats can be loaded into C# and VB.NET programs in the forms of string, stream and bitmap. Now, let's see free online demos for Aztec Code recognition as below.
How to: Using Free C# Demo
Firstly, we give all APIs that can be used for C# Aztec Code barcode decoding. As you see, there three types of C#.NET API. One is for reading all barcode symbologies from image file. The second is for reading only Aztec Code barcode symbology from image source. The last is for image that has only one barcode on it and this will help to improve recognition accuracy. By using any of them, you will get recognition result in an array of barcode information (both barcode type and data).
public static BarcodeResult[] Scan(Bitmap bitmap); public static BarcodeResult[] Scan(Stream stream); public static BarcodeResult[] Scan(string filename); public static BarcodeResult[] Scan(Bitmap bitmap, BarCodeType barType); public static BarcodeResult[] Scan(Stream stream, BarCodeType barType); public static BarcodeResult[] Scan(string filename, BarCodeType barType); public static BarcodeResult ScanSingle(Bitmap bitmap); public static BarcodeResult ScanSingle(Stream stream); public static BarcodeResult ScanSingle(string filename);
Then, Visual C#.NET demo code for scanning Aztec Code barcode from image (string) is illustrated. Here, we use a specific API to customize barcode type as Aztec Code.
public void ScanAztecFromFile(string filename) { // Customize to read only Aztec Code from image file in C# application. BarcodeResult[] results = BarCodeScanner.Scan(filename, BarCodeType.Aztec); foreach (BarcodeResult result in results) { Console.WriteLine(result.BarType.ToString() + "-" + result.Data); } }
To improve barcode recognition accuracy, you can use the following C# sample code when there's only one Aztec Code on your image.
Bitmap bmp = new Bitmap("YourImagePath"); BarcodeResult barcode = BarCodeScanner.ScanSingle(bmp); Console.WriteLine("barcode data:{0}.", barcode.Data);
How to: Using Free VB.NET Demo
If you need to detect and decode Aztec Code from image file using VB.NET programming, then have a try with the following free demo code. This Visual Basic demo code explains how to read all Aztec Code barcodes as well as other barcode symbologies from loaded image file.
Public Sub ScanAllFromFile(ByVal filename As String) ' Customize to scan all barcode symbols from image file in C# application. Dim results() As BarcodeResult = BarCodeScanner.Scan(filename) Dim result As BarcodeResult For Each result In results Console.WriteLine(result.BarType.ToString() + "-" + result.Data) Next End Sub
If your image only includes one Aztec Code, you may use the following VB.NET sample code to improve barcode reading accuracy.
Dim bmp As Bitmap = New Bitmap("YourImagePath") Dim barcode As BarcodeResult = BarCodeScanner.ScanSingle(bmp) Console.WriteLine("barcode data:{0}.", barcode.Data)
See also: Online C# Guide for Barcode Decoding, Online VB.NET Guide for Barcode Decoding.