ByteScout Barcode Reader SDK - C# - Export Results to XML, CSV, TXT - ByteScout

ByteScout Barcode Reader SDK – C# – Export Results to XML, CSV, TXT

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Reader SDK – C# – Export Results to XML, CSV, TXT

How to export results to xml, csv, TXT in C# using ByteScout BarCode Reader SDK

How to export results to xml, csv, TXT in C#

The documentation is designed to help you to implement the features on your side. ByteScout BarCode Reader SDK is the barcode decoder with support for code 39, code 128, QR Code, Datamatrix, GS1, PDF417 and all other popular barcodes. Can read barcodes from images, pdf, tiff documents and live web camera. Supports noisy and damaged documents, can split and merge pdf and tiff documents based on barcodes. Can export barcode decoder results to XML, JSON, CSV and into custom data structures. It can export results to xml, csv, TXT in C#.

C# code samples for C# developers help to speed up coding of your application when using ByteScout BarCode Reader SDK. Follow the instructions from the scratch to work and copy the C# code. Implementing C# application typically includes multiple stages of the software development so even if the functionality works please test it with your data and the production environment.

Trial version of ByteScout BarCode Reader SDK can be downloaded for free from our website. It also includes source code samples for C# and other programming languages.

Try ByteScout BarCode Reader SDK today: Get 60 Day Free Trial or sign up for Web API

Program.cs
      
using System; using System.IO; using System.Text; using System.Xml; using Bytescout.BarCodeReader; namespace ExportResults { class Program { static void Main() { Reader reader = new Reader(); reader.RegistrationName = "demo"; reader.RegistrationKey = "demo"; // Set barcode type to find reader.BarcodeTypesToFind.All1D = true; /* ----------------------------------------------------------------------- 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 reader.ReadFromFile("barcodes.pdf"); // Export to files: // ================ // 1. Export found barcodes to XML reader.ExportFoundBarcodesToXML("barcodes.xml"); // 2a. Export found barcodes to CSV with default delimiter, quotation and character encoding reader.ExportFoundBarcodesToCSV("barcodes.csv"); // 2b. Export found barcodes to CSV with custom delimiter, quotation and character encoding reader.ExportFoundBarcodesToCSV("barcodes2.csv", "|", "'", Encoding.UTF8); // 3a. Export found barcodes to plain text file in default character encoding reader.ExportFoundBarcodesToTXT("barcodes.txt"); // 3b. Export only values of found barcodes to plain text file in custom character encoding reader.ExportFoundBarcodesToTXT("barcodes2.txt", true, Encoding.ASCII); // Get formatted result to a variable for further processing // ========================================================= // 1a. Get found barcodes as XmlDocument XmlDocument xmlDocument = reader.ExportFoundBarcodesToXMLDocument(); // 1b. Get found barcodes as XML string string xmlString = reader.ExportFoundBarcodesToXML(); // 2a. Get found barcodes as string in CSV format with default delimiter and quotation string csv = reader.ExportFoundBarcodesToCSV(); // 2b. Get found barcodes as string in CSV format with custom delimiter and quotation string csv2 = reader.ExportFoundBarcodesToCSV("|", "'"); // 3. Get found barcodes as string in plain text format string txt = reader.ExportFoundBarcodesToTXT(); // 4. Get found barcodes as string in JSON format string jsonString = reader.ExportFoundBarcodesToJSON(); // Cleanup reader.Dispose(); } } }

Try ByteScout BarCode Reader SDK today: 60 Day Free Trial (on-premise version) or sign up for Web API (on demand version)

VIDEO

ON-PREMISE VERSION

Get 60 Day Free Trial or Visit ByteScout BarCode Reader SDK page

Explore ByteScout BarCode Reader SDK documentation

WEB API

Sign Up for free Web API key

Explore Web API Documentation

Tutorials:

prev
next