Your location:Home>翻译软件 条码 证书>条码软件

Dynamsoft Barcode Reader.NET

 

Barcode Recognition SDK - 1D, QRCode, DataMatrix, PDF417

Rapidly Implement Barcode Recognition to Your AppDynamsoft's Barcode Reader SDK enables you to efficiently embed barcode reading functionality in your web, desktop and mobile application using just a few lines of code. This can save you from months of added development time and extra costs. With the Barcode Reader SDK, you can decode barcodes from various image file formats (bmp, jpg, png, gif, single-page and multi-page tiff, and PDF). This includes from device-independent bitmap (DIB) formats which can be obtained from cameras or scanners.

Using Dynamsoft Barcode Reader .NET API in WinForms Application

Dynamsoft's Barcode Reader SDK provides .NET API which enables you to almost instantly embed barcode reading functionality in your .NET desktop or web applications using C# or VB.NET.In this video, I am going to demonstrate how to use the .NET barcode reading API to quickly build a WinFroms Application for 1D and 2D barcode recognition.

1.New a barcode project

First, let's create a new project. Click Templates -> Visual C# -> Windows -> Windows Forms Application. Change the name to BarcodeTest.

Drag a button to the form. And then double click to add code for its click event.

 

2.Add references

First, we need to add reference. Right click References to add Dynamsoft.BarcodeReader.dll.

The DLL can be found in the installation directory \Program Files (x86)\Dynamsoft\Barcode Reader 4.1\Components\DotNet.

3.Add namespace

Then, we add the namespace.

using Dynamsoft.Barcode;

4.Initiate Barcode

BarcodeReader reader = new BarcodeReader();

5.Barcode-reader-options

With the following snippet, we initialize the barcode reading options,

such as barcode types, how many barcodes to read per page etc.

ReaderOptions option = new ReaderOptions();

option.BarcodeFormats = BarcodeFormat.OneD;

option.MaxBarcodesToReadPerPage = 100;

reader.ReaderOptions = option;

6.Decode the barcodes

Call the DecodeFile method to decode the barcodes. If there are multiple barcodes found,

we use a loop to print out the results one by one.

 

try

{

  BarcodeResult[] results = reader.DecodeFile(@"D:\Program Files (x86)

  \Dynamsoft\Barcode Reader 4.1\Images\AllSupportedBarcodeTypes.tif");

  string strInfo = "Total barcode(s) found: " +

  results.Length.ToString() + ".\n";

  for (int i = 0; i < results.Length; ++i)

  {

    BarcodeResult barcode = results[i];

    strInfo += "Barcode " + (i+1).ToString() + ":\n";

    strInfo += barcode.BarcodeFormat.ToString() + "\n";

    strInfo += barcode.BarcodeText + "\n\n";

  }

  MessageBox.Show(strInfo);

}

  catch (BarcodeReaderException exp)

{

  MessageBox.Show("Error Code: " + exp.Code.ToString()

  + "\nError String: " + exp.Message);

}

7.Barcode Result

Build and debug the project.

Click the button. OK. We've got all the barcodes recognized.

 

北京哲想软件有限公司