KA Barcode Reader for C# Library
How to read barcodes using C# in WinForms, WPF, .NET Core, Windows apps

Using barcode reader library to scan, recognize 1D and 2D Barcode Images in C# for .NET Windows Application
Barcode Reader for C#.NET > Scan, read, recognize barcode image in C#.NET Windows app




In this page, you will learn how to quickly create a new Console app (.NET Core) windows application to scan and read barcodes from image files using C# codes.
How to create a new Console .NET Core app to read barcodes using C#?

Step 1: Create a new Console .NET Core app

Create a new Visual C# .NET Core Console App (.NET Core) project. Choose project name as KeepAutomation.BarcodeReader.ConsoleAppDemo

Choose Framework as .NET 6.0 (Long Term Support)




Step 2: Add barcode reader library dll and NuGet package to the WinForms project

Choose "Add Project Reference..." in the "Dependencies" menu to open the "Reference Manage" dialog.

Browser the target assembly KeepAutomation.BarcodeReader.Standard.dll from the downloaded package /Dll/netstandard/ and add it to the project by clicking "OK".

Select "Manage NuGet Packages..." in the "Dependencies" menu to open the "NuGet Package Manager" tab.

Select "Browse" tab and search the NuGet package "System.Drawing.Common" in the Package source "nuget.org"; and then Install the System.Drawing.Common Version 8.0.8 to the project.





Step 3: Add barcode scanning C# code in the project

Add the following C# source code to file Program.cs

using KeepAutomation.BarcodeReader;

String inputFilePath = @"C:\Demo\csharp-reader-sample-ean13-barcode.png";

String[] result = BarcodeReader.readBarcodeMessage(inputFilePath, BarcodeType.EAN13);

if (result.Length > 0)
{
    foreach (String msg in result)
    {
        Console.WriteLine("Barcode data: '" + msg + "'");
    }
}
else
{
    Console.WriteLine("No barcodes scanned!");
}
Console.WriteLine("PRESS ANY KEY TO EXIT:");
Console.ReadLine();


In the above C# codes, you will use method BarcodeReader.readBarcodeMessage() to scan, read all EAN-13 barcodes from an image file using C#.

Sample EAN-13 barcode image





Step 4: Run the WinForms app

Run the Console App from Visual Studio 2022 directly. And you can find out the scanned barcode data message in the console Window.