Link Search Menu Expand Document

Getting Started in C#

The following sample demonstrates how to read barcode from photo image using Bytescout BarCode Reader SDK for .NET

C#
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

using Bytescout.BarCodeReader;

namespace SimpleTestCSharp
{
    class Program
    {
        const string imageFile = "BarcodePhoto.jpg";

        static void Main(string[] args)
        {
            Console.WriteLine("Reading barcode(s) from image {0}", Path.GetFullPath(imageFile));

            Reader reader = new Reader();
            reader.BarcodeTypesToFind.Code39 = true;
            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();
        }
    }
}

Copyright © 2016 - 2021 ByteScout