Code 128 Image Sample -
.NET Barcode Reader SDK Building up Perfect Quality Barcode Reading Software for .NET Online Demo Download Trial Purchase Now

C# &VB.NET Demos to Scan EAN-13

back to home  >  .NET Barcode Reader SDK  >  Recognize Barcodes in .NET  >  Use Free C# and VB.NET Demos to Scan EAN-13

.NET Barcode Scanner SDK from pqScan supports reading various 1D bar codes from several image files. On this page, we will illustrate how to decode and recognize linear EAN-13 barcodes from common raster image file formats. And mature C# and VB.NET barcode reading APIs and demo codes will be provided on this page.

To have a better control on C# and VB.NET EAN-13 barcode reading applications, you may firstly know about this 1D barcode type. EAN-13 is a continuous and omni-directionally decodable barcode type. It contains an optional check digit, which can also be decoded by our Barcode Reader SDK for .NET, C#, VB.NET. This barcode symbology is one of the most commonly used linear barcodes and primarily used in supermarkets to identify products at the point of sales and used with consumer products internationally. In addition, it is a superset of UPC-A. UPC-A barcode also can be read by our reader software and you can see C# & VB.NET guide for UPC-A reading here.

Read EAN-13 with APIs and Demos

Our barcode recognition dll for C# and VB.NET provides professional APIs for reading EAN-13 barcode from three forms of images, namely bitmap, stream and string. And the supportive image formats are bmp, gif, jpeg/jpg, png, and tiff/tif. Furthermore, C# and VB.NET developers are entitled to define the target barcode type as EAN-13 with specific APIs, please see details in the demo code below.

In the following parts, you will get Visual C# and Visual Basic demo codes for scanning EAN-13 barcodes from image files. The first C# demo code is used to define EAN-13 as the target barcode and only this barcode type will be decoded. If there are other barcode types besides EAN-13 on your image source and are needed to be recognized, the second VB.NET demo is helpful which illustrates how to read all barcode types from image source.

C# Demo for EAN-13 Recognition

public void ScanEAN13FromFile(string filename)
  // Define EAN-13 as target barcode and decode all of them from image source.
  BarcodeResult[] results = BarCodeScanner.Scan(filename, BarCodeType.EAN13);

  // Use APIs below to decode EAN-13 from images in Bitmap and Stream forms.
  // public static BarcodeResult[] Scan(Bitmap bitmap, BarCodeType barType);
  // public static BarcodeResult[] Scan(Stream stream, BarCodeType barType);

  foreach (BarcodeResult result in results)
    Console.WriteLine(result.BarType.ToString() + "-" + result.Data);
// If your image only has one EAN-13, please try this way to improve barcode decoder accuracy.
Bitmap bmp = new Bitmap("YourImagePath");
BarcodeResult barcode = BarCodeScanner.ScanSingle(bmp);
Console.WriteLine("barcode data:{0}.", barcode.Data);

VB.NET Demo for EAN-13 Recognition

Public Sub ScanAllFromFile(ByVal filename As String)
  ' Used to recognize all barcode types from image source in string form.
  Dim results() As BarcodeResult = BarCodeScanner.Scan(filename) 

  ' Use APIs below to read all barcode types from images in Bitmap and Stream forms.
  ' public static BarcodeResult[] Scan(Bitmap bitmap)
  ' public static BarcodeResult[] Scan(Stream stream)

  Dim result As BarcodeResult
  For Each result In results
    Console.WriteLine(result.BarType.ToString() + "-" + result.Data)
End Sub
' If your image only has one EAN-13, please try this way to improve barcode decoder accuracy.
Dim bmp As Bitmap = New Bitmap("YourImagePath") 
Dim barcode As BarcodeResult = BarCodeScanner.ScanSingle(bmp) 
Console.WriteLine("barcode data:{0}.", barcode.Data)

For more information about C# and VB.NET barcode scanning, please refer to online tutorials: .NET Barcode Reader DLL: C# Guide and .NET Barcode Reader DLL: VB.NET Guide. Currently, recognizing EAN-13 barcode from PDF document is supported as well. If you want to do this, please firstly render PDF document pages into image files by using pqScan PDF to Image Converter SDK and then load them into C#/VB.NET barcode reading project.

pqScan SDK
.NET Barcode Scanner Software
Online Guide
Barcode Recognition for .NET Barcode Recognition Using C# Barcode Recognition Using VB
Barcode Type
C#/VB Demo for QR Code Reader C#/VB Demo PDF-417 Reader C#/VB Demo Data Matrix Reader C#/VB Demo Aztec Code Reader C#/VB Demo Code 128 Reader C#/VB Demo Code 39 Reader C#/VB Demo EAN-8 Reader C#/VB Demo UPC-A Reader C#/VB Demo UPC-E Reader C#/VB Demo Code 93 Reader C#/VB Demo Codabar Reader C#/VB Demo ITF-14 Reader View All Barcodes >>
I only have good things to say about your barcode reader software. Definitely, it is a great work, professional and effective. Also, appreciate your service support.
Great work guys! Paul Isley