Link Search Menu Expand Document

Read Barcodes From TIFF - C#

BarCode Reader SDK sample in C# demonstrating ‘Read Barcodes From TIFF’

Program.cs
using System;
using Bytescout.BarCodeReader;

namespace BarcodesFromTIFF
{
    class Program
    {
        static void Main()
        {
            Reader reader = new Reader();
            reader.RegistrationName = "demo";
            reader.RegistrationKey = "demo";

            // Limit search to 1-dimensional barcodes only (exclude 2D barcodes to speed up the processing).
            // Change to barcodeReader.BarcodeTypesToFind.SetAll() to scan for all supported 1D and 2D barcode types
            // or select specific type, e.g. barcodeReader.BarcodeTypesToFind.PDF417 = True
            reader.BarcodeTypesToFind.All1D = true;
			
			Console.WriteLine("Reading barcode(s) from TIFF image...");

            /* -----------------------------------------------------------------------
            NOTE: We can read barcodes from specific page to increase performance.
            For sample please refer to "Decode page by page from TIFF" program.
            ----------------------------------------------------------------------- */

            FoundBarcode[] barcodes = reader.ReadFrom("multipage.tif");

            foreach (FoundBarcode barcode in barcodes)
            {
                Console.WriteLine("Found barcode with type '{0}' and value '{1}' on page {2} at {3}", barcode.Type, barcode.Value, barcode.Page, barcode.Rect);
            }

            // Cleanup
            reader.Dispose();

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

Download Source Code (.zip)

Return to the previous page Explore BarCode Reader SDK