ByteScout Barcode Reader SDK - C# - WPF UI Example for barcode reading - ByteScout

ByteScout Barcode Reader SDK – C# – WPF UI Example for barcode reading

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Reader SDK – C# – WPF UI Example for barcode reading

WPF UI example for barcode reading in C# using ByteScout BarCode Reader SDK

Write code in C# to make WPF UI example for barcode reading with this How-To tutorial

Writing of the code to WPF UI example for barcode reading in C# can be done by developers of any level using ByteScout BarCode Reader SDK. ByteScout BarCode Reader SDK helps with WPF UI example for barcode reading in C#. 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.

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 implement WPF UI example for barcode reading. This C# sample code should be copied and pasted into your application’s code editor. Then just compile and run it to see how it works. Enhanced documentation and tutorials are available along with installed ByteScout BarCode Reader SDK if you’d like to dive deeper into the topic and the details of the API.

On our website you may get trial version of ByteScout BarCode Reader SDK for free. Source code samples are included to help you with your C# application.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

App.xaml.cs
      
using System; using System.Collections.Generic; using System.Configuration; using System.Windows; namespace ReadBarcodeFromImage { /// <summary> /// Interaction logic for App.xaml /// </summary> public partial class App : Application { } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

MainWindow.xaml.cs
      
using System; using System.Text; using System.Windows; using System.Windows.Input; using System.Windows.Media.Imaging; using Bytescout.BarCodeReader; namespace ReadBarcodeFromImage { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } // Select image file private void btnBrowse_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog { Filter = "Supported formats (*.bmp;*.gif;*.tif;*.png;*.jpg;*.pdf)|*.bmp;*.gif;*.tif;*.tiff;*.png;*.jpg;*.jpeg;*.pdf|All Files|*.*" }; if (dlg.ShowDialog() == true) { tbFileName.Text = dlg.FileName; tbFoundBarcodes.Text = ""; imageContainer.Source = null; try { BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.UriSource = new Uri(dlg.FileName, UriKind.Absolute); bitmapImage.EndInit(); imageContainer.Source = bitmapImage; } catch (Exception) { } } } private void btnDecode_Click(object sender, RoutedEventArgs e) { // Create barcode reader instance Reader reader = new Reader(); reader.RegistrationName = "demo"; reader.RegistrationKey = "demo"; // Specify barcode types to find reader.BarcodeTypesToFind.All = true; // Select specific barcode types to speed up the decoding process and avoid false positives. // Show wait cursor Mouse.OverrideCursor = Cursors.Wait; /* ----------------------------------------------------------------------- NOTE: We can read barcodes from specific page to increase performance. For sample please refer to "Decoding barcodes from PDF by pages" program. ----------------------------------------------------------------------- */ try { // Search for barcodes reader.ReadFrom(tbFileName.Text); } finally { Mouse.OverrideCursor = null; } // Display found barcode inforamtion: StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < reader.FoundBarcodes.Length; i++) { FoundBarcode barcode = reader.FoundBarcodes[i]; stringBuilder.AppendFormat("{0}) Type: {1}; Value: {2}.\r\n", i + 1, barcode.Type, barcode.Value); } tbFoundBarcodes.Text = stringBuilder.ToString(); // Cleanup reader.Dispose(); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

app.config
      
<?xml version="1.0"?> <configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK 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 Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next