ByteScout Barcode Reader SDK - C# - Batch Read From Files - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout Barcode Reader SDK – C# – Batch Read From Files

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Reader SDK – C# – Batch Read From Files

How to batch read from files in C# using ByteScout BarCode Reader SDK

How to code in C# to batch read from files with this step-by-step tutorial

This sample source code below will demonstrate you how to batch read from files in C#. ByteScout BarCode Reader SDK: the SDK for barcode decoding. Can read all popular types from Code 128, GS1, UPC and Code 39 to QR Code, Datamatrix, PDF417. Images, pdf, TIF images and live web camera are supported as input. Designed to handle documents with noise and defects. Includes optional splitter and merger for pdf and tiff based on barcodes. Batch mode is optimized for high performance with multiple threads. Decoded values can be exported to XML, JSON, CSV or into custom data format. It can batch read from files in C#.

This code snippet below for ByteScout BarCode Reader SDK works best when you need to quickly batch read from files in your C# application. This C# sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Code testing will allow the function to be tested and work properly with your data.

Download free trial version of ByteScout BarCode Reader SDK from our website with this and other source code samples for C#.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using System; using System.IO; using Bytescout.BarCodeReader; namespace BatchProcessing { class Program { static void Main() { // Get all JPG files from the current folder string[] filesToScan = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.jpg"); // Open file to export results StreamWriter resultsCsvFile = File.CreateText("results.csv"); // Create barcode reader instance Reader reader = new Reader(); reader.RegistrationName = "demo"; reader.RegistrationKey = "demo"; // Set barcode types for searching reader.BarcodeTypesToFind.EAN13 = true; // Iterate over images and read barcodes foreach (string file in filesToScan) { Console.WriteLine(); Console.WriteLine("Reading barcodes from image \"{0}\"...", file); /* ----------------------------------------------------------------------- NOTE: We can read barcodes from specific page to increase performance . For sample please refer to "Decoding barcodes from PDF by pages" program. ----------------------------------------------------------------------- */ // Read barcodes from image FoundBarcode[] barcodes = reader.ReadFrom(file); // Display results in console foreach (FoundBarcode barcode in barcodes) Console.WriteLine("Found barcode with type \"{0}\" and value \"{1}\".", barcode.Type, barcode.Value); // Write results to file in CSV format. Note, you can also export to TXT and XML. string csv = reader.ExportFoundBarcodesToCSV(); resultsCsvFile.Write(csv); } // Cleanup reader.Dispose(); resultsCsvFile.Dispose(); Console.WriteLine("Press any key to exit.."); Console.ReadKey(); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next