The sample source code below will teach you how to acquire barcode from scanner and decode with barcode reader sdk in C#. ByteScout Premium Suite can acquire barcode from scanner and decode with barcode reader sdk. It can be applied from C#. ByteScout Premium Suite is the bundle that includes twelve SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording.
The following code snippet for ByteScout Premium Suite works best when you need to quickly acquire barcode from scanner and decode with barcode reader sdk 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! Enjoy writing a code with ready-to-use sample C# codes.
ByteScout provides the free trial version of ByteScout Premium Suite along with the documentation and source code samples.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
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(); } } }
60 Day Free Trial or Visit ByteScout Premium Suite Home Page
Explore ByteScout Premium Suite Documentation
Explore Samples
Sign Up for ByteScout Premium Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout Premium Suite Home Page
Explore ByteScout Premium Suite Documentation
Explore Samples
Sign Up for ByteScout Premium Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: