How to Read Barcode using C#

This simple how-to topic illustrates about how to Read Barcode using C#. In order to read Barcode C# based application can be developed using simple API calls and few coding steps. You can use the example in any of .NET supported applications running in Windows, macOS and Linux operating systems with no dependency on any third party tool or other API.

Steps to Read Barcode using C#

  1. Include Aspose.BarCode for .NET from NuGet package manager
  2. Include reference to Aspose.Barcode and Aspose.BarCode.BarCodeRecognition namespaces
  3. Create an object of BarCodeReader class and load the Barcode image file
  4. Set the Barcode types using DecodeType enumerator for BarCodeReader
  5. Iterate through extracted Barcode information for further usage

The above steps in C# read Barcode from image in just few lines of code. The process will commence with adding including API using NuGet and including required namespaces. Then we will read the source PNG file having single or multiple Barcodes inside that using BarCodeReader instance. We will also set the desired Barcode types that we are interested in reading by using DecodeType enumerator. In subsequent lines the Barcode reader will extract information from the image and we will iterate that for further usage in our application.

Code to Read Barcode using C#

In the above example, in order to create a Barcode reader C# source code is used in few API calls. The API offers support for reading information from a wide variety of barcode types that are specified in DecodeType enumerator. In just few lines of code in C# Barcode scanner has been developed.

In this topic we have explored how easily an application in C# scan Barcode from a PNG image. If you are interested in generating a QR code, refer to the article on how to Generate QR Code in C#.

 English