ByteScout Barcode Reader SDK – C# – Decode EAN-5

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Reader SDK – C# – Decode EAN-5

ByteScout Barcode Reader SDK – C# – Decode EAN-5

Program.cs

using System;
using System.IO;

using Bytescout.BarCodeReader;

namespace ReadEAN5
{
    class Program
    {
        const string ImageFile = "EAN5.png";

        static void Main()
        {
            Console.WriteLine("Reading barcode(s) from image {0}", Path.GetFullPath(ImageFile));

            Reader reader = new Reader();
            reader.RegistrationName = "demo";
			reader.RegistrationKey = "demo";

            // Set barcode type to find
            reader.BarcodeTypesToFind.EAN5 = true;
            // EAN-5 barcode is normally supplemental to EAN-13 so we should force the detection of standalone EAN-5 barcode.
            reader.AllowOrphanedSupplementals = true;
            
            // Read barcodes
            FoundBarcode[] barcodes = reader.ReadFrom(ImageFile);

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

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


  Click here to get your Free Trial version of the SDK

prev
next