In this tutorial, let’s learn how to implement a simple application to scan documents with Dynamic .NET TWAIN and upload scanned images to Google Drive step by step.
Dynamic .NET TWAIN is one of the excellent TWAIN-compliant SDKs for document scanning and image capture. In this tutorial, I would like to share how to create a bridge to convert .NET TWAIN C# methods to Java methods in order to help Java developers easily implement Java TWAIN scanner software.
Dynamic .NET TWAIN 5.0 has been released for a while. To help users to quickly grasp APIs, a brand-new API demo, written in WPF with C# & VB.NET, is included. In this tutorial, we would like to show the anatomy of this application. Let’s glance at the screenshot as a warm up. As you can see, the functionalities of the demo include scanner control, image loading, barcode recognition, OCR, image manipulation and processing.
Visit Dynamic .NET TWAIN page and get the installation package by clicking “Download” button. Follow the InstallShield Wizard step by step.
The demo source code is located at “…\Dynamsoft\Dynamic .NET TWAIN 5.0 Trial\Samples\C# Samples\VS 12” and “…\Dynamsoft\Dynamic .NET TWAIN 5.0 Trial\Samples\VB .NET Samples\VS 12\WpfControlsDemo”. You can choose your preferred programming language, C# or VB.NET.
The reference DynamicDotNetTWAIN.Wpf.dll is located at “…\Dynamsoft\Dynamic .NET TWAIN 5.0 Trial\Samples\Bin”. It will be copied to your project folder when you run the Visual Studio solution file “WpfControlsDemo.sln”. If you want to create your own project, don’t forget to add it. In this project, we have created three windows. The main window is “Window1.xaml”.
All implementation logics are same no matter which language you choose. Let’s illustrate with C#.
We’re proud to reveal that Dynamsoft’s Dynamic .NET TWAIN 5.0 is on its way to release soon. In addition to WinForms support, the new version will include a WPF control. You can use it in your WPF app to capture images from TWAIN scanners and UVC/WIA webcams, to edit and save images to local disks, to a server or a database. Today, I’d like to cover how, using VB.NET, you can use the Dynamic .NET TWAIN 5.0 SDK to implement barcode reading in a WPF application.
The relevant source code can be downloaded here.
First, start Visual Studio .NET, and create a new WPF project. Select Visual Basic as the type and choose WPF Application as the template.
Right-click on the project root, and select Add Reference… from the menu. Click Browse to locate DynamicDotNetTWAIN.dll and add it.
If there is no Dynamic .NET TWAIN component available, you might need to open the toolbox. To do so, right-click on the panel and select Choose Items… Switch to the tab WPF Components and click Browse… to load DynamicDotNetTWAIN.Wpf.dll
Next, you’ll want to drag two buttons and one textbox from the toolbox to design a form. The buttons are used to load an image and make the detection of a barcode. And, the textbox is used to display the information decoded from barcode.
Now, what you need to do is to acquire an image using the Windows standard API. Then you’ll need to load it using the Dynamic .NET TWAIN component method. Just a couple of lines of code are needed for loading an image. It’s pretty simple.
Dim filedlg As OpenFileDialog filedlg = New OpenFileDialog() filedlg.Multiselect = True Dim strFilename As String If (filedlg.ShowDialog() = DialogResult.OK) Then For Each strFilename In filedlg.FileNames DynamicDotNetTwain1.LoadImage(strFilename) Next End If
To decode a barcode, the path for the barcode library needs to be first be specified. Then, with one additional line of code, you’ll get results.
Dim strDllFolder As String strDllFolder = Application.ExecutablePath Dim pos As Integer pos = strDllFolder.LastIndexOf("\Samples\") If (pos <> -1) Then strDllFolder = strDllFolder.Substring(0, strDllFolder.IndexOf("\", pos)) + "\Bin\BarcodeResources\" End If Me.DynamicDotNetTwain1.BarcodeDllPath = strDllFolder
Me.TextBox1.Text = "" Dim aryResult() As Result aryResult = Me.DynamicDotNetTwain1.ReadBarcode(Me.DynamicDotNetTwain1.CurrentImageIndexInBuffer, BarcodeFormat.All) Dim strText As StringBuilder strText = New StringBuilder() If aryResult.Length = 1 Then strText.AppendFormat(aryResult.Length & " total barcode" & ("") & " found." & Constants.vbCrLf) Else strText.AppendFormat(aryResult.Length & " total barcode" & ("s") & " found." & Constants.vbCrLf) End If For i As Integer = 0 To aryResult.Length - 1 Dim objResult As Result objResult = aryResult(i) strText.AppendFormat(" Result " & (i + 1) & Constants.vbCrLf) strText.AppendFormat(" BarcodeFormat: " & objResult.BarcodeFormat.ToString() & Constants.vbCrLf) strText.AppendFormat(" Text read: " & objResult.Text & Constants.vbCrLf) Next i Me.TextBox1.Text = strText.ToString()
I hope this brief tutorial is helpful to anyone who is looking for a .NET barcode reader SDK in VB.NET.
For further inquiries, please feel free to send me an email at kgao[at]dynamsoft.com.
Dynamic .NET TWAIN 5.0 is scheduled to be released late next month. To stay informed about all our product announcements, blog posts and more, be sure to follow us on Twitter, like us on Facebook or add us on Google+. Also, if you’d like to be amongst the first to try out the new version first, please contact support[at]dynamsoft.com.
I’m pleased to announce that Dynamic Web TWAIN 9.1 is released on August 27th, 2013.
Three exciting improvements are included in this new version:
I’d love to hear any comments or suggestions about this new version. Please don’t hesitate to contact me (firstname.lastname@example.org).
You may get problems when using your application with some scanners and wonder whether it is the issue with your application or it is the device issue.
If you are using a TWAIN library and your application is supposed to work with all TWAIN compatible devices, you can use Twacker, which is a TWAIN application developed by The TWAIN Working Group. It allows you to exercise features of a TWAIN driver and to see whether the driver of your device is working fine or not.
You can download Twacker installers here:
After the installation, you can follow the steps below to test your scanners.
With UI hidden, you can use the Automatic Feeding setting to test ADF scanning.
Click Acquire to initiate scanning and see how your device works.
Under Special menu, you can also check the TWAIN State transition info.
You can also test your scanner using the online demo of Dynamic Web TWAIN, which is a browser-based TWAIN SDK. You only need to install an ActiveX/Plug-in for your browser (Internet Explorer/Chrome/Firefox, Safari) and have a quick check for your scanner online.
Since Internet Explorer 7 on Windows Vista was released, Protected Mode has been introduced as a new security feature. When running in Protected Mode, Internet Explorer is a low integrity process and has limited permissions to access the user system.
When running Dynamic Web TWAIN, the scanner browser plugin for web application, on Windows Vista and above, IE Protected Mode is on by default so users consistently get issues like the following:
With Dynamic Web TWAIN v9.0, you can now use an independent broker process to communicate with the scanners for better compatibility and robustness.
Read more: How to work with IE Protected Mode?
I am pleased to announce that version 9.0 is now available!
Three dramatic improvements are included in this new version:
For full release notes, please refer to here.
I’d love to hear any comments or suggestions about this new version. Please don’t hesitate to contact me.
In some scenarios, such as Visitor Monitoring module for a government department or Patient Tracking module for a hospital, we may need to take a snap of human faces, patient charts, user IDs and so on and then upload them to a central server. How do we implement this for a web application?
In this article, we are going to take a look at the 3rd option – Dynamic Webcam SDK. Unlike in the first 2 options where a developer needs to deal with camera initialization, an image capturing, editing encoding and uploading separately, everything is encapsulated in Dynamic Webcam SDK.
Dynamic Webcam SDK is a browser plugin which enables users to acquire images from a webcam, edit and then upload/save them to a database, web server or local disk. Also, it can capture a live video stream into a container and grab a snapshot to be exported to a file/binary. The plugin works with all webcams that are compatible with Windows Image Acquisition (WIA) and USB video device class (UVC).
Two editions are provided for different browsers: ActiveX Edition for IE and Plugin Edition for other browsers on Windows OS.
|Client Side||Server Side|
|ActiveX Edition – x86 x64
Plugin Edition – on Windows
|IIS, Tomcat, Apache and more|
Here you can see a working application:
Firstly, copy DynamicWebcam.cab to the web server. There are 32-bit and 64-bit CAB files. Choose the proper one according to the needs. The trial and full versions of Dynamic Webcam use different class-ids.
DynamicWebcam.cab can be found in the installation folder of Dynamic Webcam SDK.
For the TRIAL version of Dynamic Webcam, insert the following code in your JS code:
<object classid="clsid:A65BC1E1-B2CE-4251-A0CB-721AC7E02B52" id="DynamicWebcam1" width="143" height="156" CodeBase = "DynamicWebcam.cab#version=8,0"> </object>
Plug-in edition can be used in Gecko-based browsers including Firefox, Chrome, Safari & Opera on PC. Please copy DynamicWebcam.msi to the web server.
A lot of businesses and organizations have a bunch of existing digital documents and images that require to be handled. These digital materials might be shared documents for different departments in the company, collected images from the customers, and more.
In this article, I’ll share with you on how to take advantage of a third-party image acquisition & processing component Dynamic Web TWAIN to handle these existing images. The following samples are based on the assumption that you’ve installed Dynamsoft’s Dynamic Web TWAIN on your development machine (30-Day Free Trial Download).
Load Images from Local Folders
You can use the LoadImage method to load images from your local disk or a shared folder. Supported image format includes BMP, JPEG, PNG, TIFF (both single and multi-page) and PDF (both single and multi-page).
LoadImage is a perfect method for image loading if you know the exact path and name of the images. If you want to provide a flexible way for your customers to load their local images, you can set IfShowFileDialog to true to show the browser dialog box.
Check out the feature in action: Dynamic Web TWAIN Online Demo
Download Images from Web Server or Database
Download Images from FTP Site
After loading the images to your web application, you can further process them, for instance, scanning new documents and uploading all of them to your library.