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

UPC-A Reading Using C# & VB.NET

back to home  >  .NET Barcode Reader SDK  >  Recognize Barcodes in .NET  >  C# and VB.NET UPC-A Reading Demos

This page is provided to help C#.NET and VB.NET users to solve the problem of how to recognize UPC-A barcode from C# project image. It contains two parts, which offers robust APIs and online demos for scanning linear barcode UPC-A from image stream, image at local disk and image in Bitmap form. And your input images can be the formats of BMP, GIF, JPEG, PNG and TIFF.

On the whole, pqScan .NET Barcode Reading Tool package empowers C# and VB.NET programmers to easily add UPC-A barcode reading features into .NET programs. After you download the package, you are supposed to find PQScan.BarcodeScanner.dll and directly add it to your project reference for later use.

C#: Read UPC-A from Image (String)

Reading barcode from image stream in C# application is an easy work. C# developers can implement fast UPC-A bar code recognition from image string with the help of following APIs. By defining a file path, image source can be quickly loaded and UPC-A barcodes on it will be scanned and decoded within seconds.

public static BarcodeResult[] Scan(string filename);
public static BarcodeResult[] Scan(string filename, BarCodeType barType);

The first API is for all barcodes reading and the second one is used to decode UPC-A from loaded image only. And here, we give you a C# sample code for implementing UPC-A barcode scanning. APIs for reading UPC-A from stream or bitmap of image are also illustrated.

public void ScanUPCAFromFile(string filename)
  // Recognize UPC-A from image file in C# application.
  BarcodeResult[] results = BarCodeScanner.Scan(filename, BarCodeType.UPCA);

  // Recognize UPC-A from Bitmap or Stream of image in C# application.
  // 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);

VB.NET: Scan UPC-A from Image (String)

This part depicts .NET APIs and VB.NET demo code that you can use for VB.NET UPC-A barcode reading from image file. The first API below is used to recognize all barcodes on your loaded image file and the second API is for reading a specific barcode type (UPC-A) from local image file.

public static BarcodeResult[] Scan(string filename)
public static BarcodeResult[] Scan(string filename, BarCodeType barType)

You may directly copy the following Visual Basic sample code into your .NET project to test UPC-A barcode scanning feature of our Barcode Recognition Control for .NET.

Public Sub ScanAllFromFile(ByVal filename As String)
  ' Decode all barcode types from a String of image source in VB.NET programming.
  Dim results() As BarcodeResult = BarCodeScanner.Scan(filename)

  ' APIs for decoding all barcode types from a Bitmap or Stream of image source in VB.NET application.
  ' 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

In addition to reading barcode image from raster image files, we also provide .NET solution for PDF barcode image recognition. Please see respective online C# and VB.NET tutorials here: Online C# Tutorial - PDF Barcode Decoding, Online VB.NET Tutorial - PDF Barcode Decoding.

pqScan SDK
.NET Barcode Decoder Software
Online Guide
Barcode Decoding for .NET Barcode Decoding Using C# Barcode Decoding Using VB
Barcode Type
C#/VB: Scan 2D QR Code C#/VB: Scan 2D PDF-417 C#/VB: Scan 2D Data Matrix C#/VB: Scan 2D Aztec Code C#/VB: Scan 1D Code 128 C#/VB: Scan 1D Code 39 C#/VB: Scan 1D EAN-13 C#/VB: Scan 1D EAN-8 C#/VB: Scan 1D UPC-E C#/VB: Scan 1D Code 93 C#/VB: Scan 1D Codabar C#/VB: Scan 1D ITF-14 View All Barcodes >>
Just writing this to express my complete satisfaction of your product and service. I am especially pleased with the professionalism and timeliness given by your staff. Keith Shiffman