ByteScout Barcode Reader SDK - C# - Acquire Barcode From Scanner And Decode - ByteScout

ByteScout Barcode Reader SDK – C# – Acquire Barcode From Scanner And Decode

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Reader SDK – C# – Acquire Barcode From Scanner And Decode

How to acquire barcode from scanner and decode in C# with ByteScout BarCode Reader SDK

Tutorial on how to acquire barcode from scanner and decode in C#

The coding tutorials are designed to help you test the features without need to write your own code. ByteScout BarCode Reader SDK can acquire barcode from scanner and decode. It can be used from C#. ByteScout BarCode Reader SDK is the SDK for reading of barcodes from PDF, images and live camera or video. Almost every common type like Code 39, Code 128, GS1, UPC, QR Code, Datamatrix, PDF417 and many others are supported. Supports noisy and defective images and docs. Includes optional documents splitter and merger for pdf and tiff based on found barcodess. Batch mode is supported for superior performance using multiple threads. Decoded values are easily exported to JSON, CSV, XML and to custom format.

This rich sample source code in C# for ByteScout BarCode Reader SDK includes the number of functions and options you should do calling the API to acquire barcode from scanner and decode. Just copy and paste the code into your C# application’s code and follow the instruction. 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.

ByteScout BarCode Reader SDK free trial version is available on our website. C# and other programming languages are supported.

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

using System; using System.IO; using System.Text; using System.Windows.Forms; using Bytescout.BarCodeReader; // This example demonstrates camera image acquiring using Windows Image Acquisition (WIA) interface. // BarCode Reader SDK has builtin WIAImageScanner class for WIA. // If you experienced issues with this example, please try another example located in /Visual Basic.NET/Read From Live Video Cam/ namespace BarcodeFromWebCam { static class Program { static void Main() { // Use WIAImageScanner image acquisition module WIAImageScanner wiaScanner = new WIAImageScanner(); wiaScanner.OutputFileNameTemplate = "BarCodeReader-scanned"; wiaScanner.OutputImageFormat = WiaImageFormatType.PNG; wiaScanner.ImageQuality = WiaImageBias.MaximizeQuality; wiaScanner.ImageIntent = WiaImageIntent.UnspecifiedIntent; wiaScanner.ShowDeviceSelectionDialog = true; try { // Run Acquire and exit if canceled or zero images if (!wiaScanner.Acquire()) return; } catch (Exception e) { string message = e.Message; if (e.InnerException != null) message = message + "\r\n\r\n" + e.InnerException.Message; MessageBox.Show("Failed acquiring images:\r\n\r\n" + message); return; } // Create barcode reader Reader reader = new Reader(); reader.RegistrationName = "demo"; reader.RegistrationKey = "demo"; // Enable decoding of ALL known barcode types. reader.BarcodeTypesToFind.All = true; // To speed up the processing and avoid false positives select specific barcodes type, // e.g. barcodeReader.BarcodeTypesToFind.PDF417 = True /* ----------------------------------------------------------------------- NOTE: We can read barcodes from specific page to increase performance . For sample please refer to "Decoding barcodes from PDF by pages" program. ----------------------------------------------------------------------- */ FoundBarcode[] barcodes = reader.ReadFrom(wiaScanner.OutputFiles[0]); if (barcodes.Length > 0) { StringBuilder builder = new StringBuilder(); foreach (FoundBarcode barcode in barcodes) builder.AppendLine(String.Format("Found barcode with type '{0}' and value '{1}'", barcode.Type, barcode.Value)); MessageBox.Show(builder.ToString()); } else { MessageBox.Show(wiaScanner.OutputFiles[0] + "\r\n\r\nCould not find any barcode."); } // 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)



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

Explore ByteScout BarCode Reader SDK documentation


Sign Up for free Web API key

Explore Web API Documentation