ByteScout Barcode Suite - C# - Acquire barcode from scanner and decode with barcode reader sdk - ByteScout

ByteScout Barcode Suite – C# – Acquire barcode from scanner and decode with barcode reader sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Suite – C# – Acquire barcode from scanner and decode with barcode reader sdk

How to acquire barcode from scanner and decode with barcode reader sdk in C# with ByteScout Barcode Suite

Step-by-step tutorial on how to acquire barcode from scanner and decode with barcode reader sdk in C#

Acquire barcode from scanner and decode with barcode reader sdk is simple to apply in C# if you use these source codes below. ByteScout Barcode Suite is the bundle that privides 3 SDK products to generate barcodes (Barcode SDK), read barcodes (Barcode Reaer SDK) and read and write spreadsheets (Spreadsheet SDK). It can be applied to acquire barcode from scanner and decode with barcode reader sdk using C#.

The SDK samples given below describe how to quickly make your application do acquire barcode from scanner and decode with barcode reader sdk in C# with the help of ByteScout Barcode Suite. Follow the instructions from scratch to work and copy the C# code. Use of ByteScout Barcode Suite in C# is also described in the documentation included along with the product.

If you want to try other source code samples then the free trial version of ByteScout Barcode 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.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(); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

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

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next