ByteScout Barcode Reader SDK – C# – Decode Damaged Code 128

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Reader SDK – C# – Decode Damaged Code 128

ByteScout Barcode Reader SDK – C# – Decode Damaged Code 128

Program.cs

using System;
using Bytescout.BarCodeReader;

namespace DecodeDamagedCode128
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                // Create and activate Bytescout.BarCodeReader.Reader instance
                using (Reader reader = new Reader("demo", "demo"))
                {
                    // Set barcode type to find
                    reader.BarcodeTypesToFind.Code128 = true;

                    // Read barcodes
                    FoundBarcode[] barcodes = reader.ReadFrom("corrupted_barcode_code128.png");

                    foreach (FoundBarcode code in barcodes)
                        Console.WriteLine("Found barcode with type '{0}' and value '{1}'", code.Type, code.Value);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine();
            Console.WriteLine("Press any key to exit...");
            Console.ReadLine();
        }
    }
}

  Click here to get your Free Trial version of the SDK

prev
next