ByteScout Data Extraction Suite - C# - Batch read barcodes to csv with barcode reader sdk - ByteScout

ByteScout Data Extraction Suite – C# – Batch read barcodes to csv with barcode reader sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Data Extraction Suite – C# – Batch read barcodes to csv with barcode reader sdk

How to batch read barcodes to csv with barcode reader sdk in C# using ByteScout Data Extraction Suite

If you want to learn more then this tutorial will show how to batch read barcodes to csv with barcode reader sdk in C#

Source code documentation samples give simple and easy method to install a needed feature into your application. ByteScout Data Extraction Suite can batch read barcodes to csv with barcode reader sdk. It can be applied from C#. ByteScout Data Extraction Suite is the bundle that includes three SDK tools for data extraction from PDF, scans, images and from spreadsheets: PDF Extractor SDK, Data Extraction SDK, Barcode Reader SDK.

Want to save time? You will save a lot of time on writing and testing code as you may just take the C# code from ByteScout Data Extraction Suite for batch read barcodes to csv with barcode reader sdk below and use it in your application. Just copy and paste the code into your C# application’s code and follow the instructions. Applying C# application mostly includes various stages of the software development so even if the functionality works please test it with your data and the production environment.

If you want to try other source code samples then the free trial version of ByteScout Data Extraction Suite is available for download from our website. Just try 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.Collections.Generic; using System.Diagnostics; using Bytescout.BarCodeReader; namespace ImagePDFBarcodeToCSV { class Program { static void Main(string[] args) { try { //Read Barcode Process Reader reader = new Reader(); reader.RegistrationKey = "demo"; reader.RegistrationName = "demo"; // Set Barcode type to find reader.BarcodeTypesToFind.All = true; // Output list List<CSVOutputFormat> lstCSVOutput = new List<CSVOutputFormat>(); // Get all files in folder, and iterate through each file var files = System.IO.Directory.GetFiles("BarcodeFiles"); foreach (var fileName in files) { /* ----------------------------------------------------------------------- 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 FoundBarcode[] barcodes = reader.ReadFrom(fileName); foreach (FoundBarcode code in barcodes) { lstCSVOutput.Add(new CSVOutputFormat { barcodeValue = code.Value, barcodeType = code.Type.ToString(), scanDateTime = DateTime.Now.ToString(), fileName = fileName }); } } Console.WriteLine("Total {0} barcode found in {1} file.", lstCSVOutput.Count, files.Length); // cleanup reader.Dispose(); // Export to CSV ExportToCsv(lstCSVOutput); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine("Press enter key to exit..."); Console.ReadLine(); } /// <summary> /// Exports to CSV /// </summary> /// <param name="lstCSVOutput"></param> private static void ExportToCsv(List<CSVOutputFormat> lstCSVOutput) { System.Text.StringBuilder csvOutputContent = new System.Text.StringBuilder(string.Empty); csvOutputContent.Append("Barcode Value,Barcode Type,Scan DateTime,File Name"); foreach (var item in lstCSVOutput) { csvOutputContent.AppendFormat("\r\n{0},{1},{2},{3}", item.barcodeValue, item.barcodeType, item.scanDateTime, item.fileName); } System.IO.File.WriteAllText("output.csv", csvOutputContent.ToString()); Process.Start("output.csv"); } } class CSVOutputFormat { public string barcodeValue { get; set; } public string barcodeType { get; set; } public string scanDateTime { get; set; } public string fileName { get; set; } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite 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 Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next