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 Guide for Code 93 Reading

back to home  >  .NET Barcode Reader SDK  >  Recognize Barcodes in .NET  >  C# & VB.NET Guide for Code 93 Reading

pqScan .NET Component for Barcode Scanning supports recognizing commonly used linear barcodes, like Code 93, Codabar, Code 39, Code 128, ITF-14, and EAN/UPC. You can use C# and VB.NET programming codes to implement barcode scanning. On this guide page, we will illustrate how to read Code 93 barcodes using C# programming code and how to scan Code 93 barcodes using VB.NET programming code. For all barcode symbols recognition tutorials, please see C# Guide: 1D & 2D Barcodes Recognition and VB.NET Guide: 1D & 2D Barcodes Recognition.

Here's something you should know first about Code 93 1D barcode. According to latest barcode specifications, this barcode symbology should have mandatory two Modulo-47 check digits ("CK"). Therefore, the last two digits of decoded barcode data will be these check digits. BTW, the first data of Code 93 bar code will be recognized and output randomly if you are using free trial of pqScan .NET Barcode Reader Component.

C# Code for Code 93 Scanning

Free C# sample code below can be used to read and decode Code 93 bar codes from an image file on your local disk. Currently, raster images in Png, Bmp, Gif, Tiff, and Jpeg can be loaded into your Visual Studio C# project, in the form of bitmap, stream or string. Please see detailed APIs and demo code as below.

public void ScanCode93FromFile(string filename)
  // Recognize Code 93 from a local image file in C# project.
  BarcodeResult[] results = BarCodeScanner.Scan(filename, BarCodeType.Code93);

  // Recognize Code 93 from a Bitmap or Stream of image in C# project.
  // 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);

Moreover, we provide the way to read and decode single Code 93 barcode from image in C# project. It can help to improve the accuracy of barcode reading when you image has only one barcode.

Bitmap bmp = new Bitmap("YourImagePath");
BarcodeResult barcode = BarCodeScanner.ScanSingle(bmp);
Console.WriteLine("barcode data:{0}.", barcode.Data);

If you want to read Code 93 barcode symbol from PDF document, you are supposed to convert PDF document to image(s) and then read Code 93 from the rendered image(s). Here, we provide a PDF to image conversion solution. Please see details here: .NET PDF to Image Conversion Guide.

VB.NET Code for Code 93 Scanning

In the above C# example, Code 93 is defined as target barcode type. Then, if you want to recognize other barcode types on loaded image source besides Code 93, the following VB.NET demo code and APIs should be used.

Public Sub ScanAllFromFile(ByVal filename As String)
  ' Recognize all barcodes from image source in string value.
  Dim results() As BarcodeResult = BarCodeScanner.Scan(filename)

  ' Recognize all barcodes from images in Bitmap and Stream values.
  ' 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

For single Code 93 barcode scanning, please copy the following VB.NET sample code to your VS project.

' Used to improve barcode scanner accuracy when there's only one Code 93 on your image.
Dim bmp As Bitmap = New Bitmap("YourImagePath") 
Dim barcode As BarcodeResult = BarCodeScanner.ScanSingle(bmp) 
Console.WriteLine("barcode data:{0}.", barcode.Data)
pqScan SDK
.NET Barcode Reader Control
Online Guide
.NET Barcode Reading Guide C# Barcode Reading Guide VB.NET Barcode Reading Guide
Barcode Type
Decoding QR Code in C#/VB Decoding PDF-417 in C#/VB Decoding Data Matrix in C#/VB Decoding Aztec Code in C#/VB Decoding Code 128 in C#/VB Decoding Code 39 in C#/VB Decoding EAN-13 in C#/VB Decoding EAN-8 in C#/VB Decoding UPC-A in C#/VB Decoding UPC-E in C#/VB Decoding Codabar in C#/VB Decoding ITF-14 in C#/VB View All Barcodes >>
This software is very easy to implement and looks very comprehensive as far as supported barcode types are concerned. Mcollins Litts