Knowledge Base

The leading provider of version control solutions and TWAIN SDKs

How to update your barcode reading module to work with Dynamic .NET TWAIN 6.x?

For Dynamic .NET TWAIN v6.x and lower versions only, for V7.x+ please refer to

Since Dynamic .NET TWAIN 6.0, the old Barcode libraries are replaced with the .Net libraries of Dynamsoft Barcode Reader, which provide better performance. This article shows how to use the new barcode libraries in the latest version of Dynamic .NET TWAIN after upgrading from the v4.x/5.x.

Option #1[Recommended]: Use the new Barcode Reader library with Dynamic .NET TWAIN 6.x

Please follow the below steps to update your barcode reading module to work with Dynamic .NET TWAIN 6.x

  1. Choose a proper DLL according to your target framework (.Net Framework 2.0/4.0).

    Once you install Dynamic .Net TWAIN, you can find the DLLs in the below paths.
    {Install Path}\Redistributable\Barcode Reader\For .NET 2.0\ Dynamsoft.BarcodeReader.dll
    {Install Path}\Redistributable\Barcode Reader\For .NET 4.0\ Dynamsoft.BarcodeReader.dll

  2. Add the target DLL to the reference of your application.
    #1. Navigate to the Solution Explorer of VS.
    #2. Right-click on the item References and click Add Reference.
    #3. Browse to the target directory that saves the Dynamsoft.BarcodeReader.dll.
    #4. Choose and add.

  3. Add a name space in your code as below.
    using Dynamsoft.Barcode;
  4. Modify your code for barcode detecting.

    Please note that the barcode detecting result could be NULL using Dynamsoft.BarcodeReader.dll. Your code may need to be modified for this change.

    using Dynamsoft.Barcode;
    private void ReadBarcode(){
        //****************** Initialize the barcode reader ******************-//
        BarcodeReader barcodeReader = new BarcodeReader();
        //Activate the component with the key of Dynamsoft Barcode Reader
        barcodeReader.LicenseKeys = "×××";
        //using OR statement to support decoding various formats, PDF417 & QR_Code.
        barcodeReader.ReaderOptions.BarcodeFormats = Dynamsoft.Barcode.BarcodeFormat.PDF417 | Dynamsoft.Barcode.BarcodeFormat.QR_CODE;
        barcodeReader.ReaderOptions.MaxBarcodesToReadPerPage = xxx;
        System.Drawing.Bitmap bmp = null;
        //**** For Winform application, get barode images in format bitmaps to decode ****-//
        bmp = (Bitmap)this.dynamicDotNetTwain1.GetImage(this.dynamicDotNetTwain1.CurrentImageIndexInBuffer);
        //**** For WPF application, get barode images in format bitmaps to decode ****-//
        bmp = this.dynamicDotNetTwain1.GetBitmap(dynamicDotNetTwain1.CurrentImageIndexInBuffer);
        //****************** Display the result ******************-// 
       	BarcodeResult[] aryResult = barcodeReader.DecodeBitmap(bmp);
        if (aryResult != null)//result could be null
          	for (int i = 0; i < aryResult.Length; i++)
              		BarcodeResult objResult = aryResult[i];
              		Console.Out.WriteLine("Result " + (i + 1));
              		Console.Out.WriteLine("BarcodeFormat: " + objResult.BarcodeFormat.ToString());
              		Console.Out.WriteLine("Text read: " + objResult.BarcodeText);

If you’d like to check with a running sample, please refer to the Read 1D and 2D barcodes sample in the Programming Guide of Dynamic .Net TWAIN SDK. For WPF application, please refer to the Scan document in WPF App.

Option #2[Deprecated]: Use the old Barcode libraries with Dynamic .NET TWAIN 6.x

This optition is only available for the customers who upgraded Dynamic .NET TWAIN from v4.x/5.x to v6.x and don't want to modify the code. If so, please make sure the old Barcode libaries are included in your project and referred to correctlly. Then you need to register the old barcode license through the property LicenseKeys as below.

// XXX is the 4.x or 5.x barcode reader license
dynamicDotNetTwain1.LicenseKeys = "XXX";
IMPORTANT: Option #2 only works when the barcode license version agrees with the barcode libraries'. I.e. v4 barcode libaries need a v4 license.

  Dynamsoft will no longer maintain the old barcode library. So we sincerely recommend you the Option#1.

If you need any assistance or have any problem, please feel free to contact us.

Article Details

Last Updated
16th of November, 2015

Would you like to...

Print this page Print this page

Email this page Email this page

Post a comment Post a comment

Subscribe me

Add to favorites Add to favorites

Remove Highlighting Remove Highlighting

Edit this Article

Quick Edit

Export to PDF

User Opinions (0 votes)

No users have voted.

How would you rate this answer?

Thank you for rating this answer.

Related Articles

No related articles were found.


No attachments were found.