WebTWAIN II ActiveX Control Overview | |
WARNING:WebTWAIN II is deprecated due to changes that Microsoft made to Internet Explorer. It is no longer supported! WebTWAIN II is an ActiveX control that primarliy provides for image aquisition from a TWAIN source. It was specifically designed to be used in combination with an image uploading Webpage and provides additional functionality to accomplish this. The control is useful in Web-based applications where users are required to scan a document or image for uploading to a remote webserver, such as legal documents, received invoices etc. Image & File uploading are well known and widely used web application constructs. Talking to a TWAIN source and generating a file directly compatible with browser-based file uploading is however not. With the WebTWAIN control, you can embed the scanning functionality directly into your webpage and still perform the file uploading according to standard uploading mechanisms. This means that you can directly perform scanning from within your Webpage. |
Communicating with a TWAIN source is not difficult and is pretty much common knowledge. If you have some basic
programming skills, you could write this ActiveX control yourself. What makes WebTWAIN different though, is its
ability to insert values into an HTML form's <INPUT TYPE=FILE> file input box. As anyone that
has tried to script an <INPUT TYPE=FILE> input box knows, the input box cannot be made to respond to script instructions to
give it a value. It is not difficult to see why : If the value of the file input box could be scripted, it would be pretty
easy to write a malicious webpage that uploads any file on the client computer to a webserver. Although this is good for
general security, it is a pain in the backside for anyone implementing file generation intended for file upload through an ActiveX Control. To overcome
this, WebTWAIN contains functionality to get the name of the scanned file into a file upload box. This is done through
a combination of script and an ActiveX Control method (and no, it's not sendkeys ;)
|
WebTWAIN II New Features | ||
WebTWAIN II in Graphic Button Style |
Through the years, WebTWAIN has been enhanced in various ways. First of all, it has gained resizing abilities so that you can size it to whatever your application requirements demand. Secondly, we've provided WebTWAIN with a graphic button look in addition to the standard text buttons. The graphic buttons take up substantially less space than the text buttons and are useful when your screen space is at a premium. It also provides WebTWAIN with a very basic form of language independence because the graphic symbols are not tied to any specific language. We've further found that WebTWAIN lends itself very well to document management applications. The convenience of scanning directly from a webpage makes capturing of corporate paper documents and/or faxes ideal in the implementation of CRM or Accounting systems. To make it even more flexible, we've also made WebTWAIN accept pasted images from the clipboard. This is performed by right clicking on the image portion of WebTWAIN. This pops up a little menu with an item Paste Image. So instead of scanning an image from a TWAIN device, you can paste images into WebTWAIN as if they were scanned. Why is this useful? Well, in our business we often purchase items and services online. All this is done via the Web, but after a purchase we would like a record of the items purchased within our job tracking system. By pressing ALT-PrintScreen on the window where the purchase results are, the contents of the window is copied onto the clipboard. By pasting such an image into WebTWAIN now, we have a document record of the on-screen purchase information. The nicer thing is that this "pasted" document is handled in exactly the same way as our scanned documents. |
Adding the Paste functionality made us wonder whether we could not also get WebTWAIN to handle text information. After all, often one also wishes to capture a simple piece of text such as an email in a standard document way. So we added text capture functionality to WebTWAIN as well. This is implemented by allowing WebTWAIN to operate in one of two modes : Scan Mode and Text Mode. Scan Mode provides the Scan and Image Paste functionality, while text mode provides text capture functionality. When operating in text mode, the control has no way of knowing when the text capture has been completed. Hence, the user needs to click on the Done button to finalise a text capture. A mode change button on the control allows easy switching between the two modes. Of course, pasting text is not a difficult function to implement with standard web elements such as a <TEXTAREA>. However, because WebTWAIN handles scans, pasted images and text pastes in exactly the same manner, it can act as a universal document capture object. Two other enhancements are present in WebTWAIN II. The first of these is the implementation of FTP functionality. This allows the control to FTP acquired images (or text documents) to an FTP Server. This is useful in cases where one does not want to use forms-based file uploading. The other allows WebTWAIN to save acquired images not as JPG images, but as timestamped PDF Files. The latter is useful if you prefer working with PDF documents than JPG images. |
WebTWAIN II in Text Capture Mode |
Relevant WebTWAIN II Control Properties, Methods and Events | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sample HTML code for using the control | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<HTML> <HEAD> <SCRIPT LANGUAGE="VBScript"> <!-- Sub window_onLoad() document.X.WebTWAIN2.ControlMode = 0 document.X.WebTWAIN2.FilePath = "c:\" document.X.WebTWAIN2.Quality = 80 document.X.WebTWAIN2.SaveAsPDF = False document.X.WebTWAIN2.ShowModeButton = True document.X.WebTWAIN2.SetSize 300,300 End Sub --> </SCRIPT> <TITLE>WebTWAIN II Sample</TITLE> </HEAD> <BODY BGCOLOR=CYAN> <CENTER> <FORM ACTION="myfileuploader.asp" METHOD="POST" ENCTYPE="multipart/form-data" NAME="X"> <TABLE BORDER=1> <TR> <TD> <SCRIPT LANGUAGE="VBScript"> <!-- Sub WebTWAIN2_ScanComplete(FileName) Dim ICount Dim M Dim R Dim Server Dim UserName Dim Password M = "A Document named " M = M & document.X.WebTWAIN2.CurrentName M = M & " (" & document.X.WebTWAIN2.ImageSize & " bytes) " M = M & "was successfully acquired." M = M & vbcrlf & vbcrlf M = M & "Do you wish to FTP this to a remote FTP Server ?" R = MsgBox(M,vbQuestion + vbYesNo,"Please Confirm") If R = vbYes Then M = "Please enter the FTP Server's IP Address or Name" Server = InputBox(M,"Server Address") Setver = Trim(Server) If Len(Server) > 0 Then M = "Please enter your FTP Username" UserName = InputBox(M,"UserName") UserName = Trim(UserName) If Len(UserName) > 0 Then M = "Please enter your FTP Password" Password = InputBox(M,"Password") Password = Trim(Password) If Len(Password) > 0 Then M = "" M = document.X.WebTWAIN2.UploadFile(Server,UserName,Password) If Len(M) > 0 Then M = "The FTP Transfer Failed with the following error : " & M MsgBox M,vbCritical,"FTP Failed" Else M = "The File was successfully FTP'ed" MsgBox M,vbInformation End If End If End If End If End If M = "Do you wish to paste the Filename into the HTML Form ?" R = MsgBox(M,vbQuestion + vbYesNo,"Please Confirm") If R = vbYes Then document.X.doc.focus() document.X.WebTWAIN2.PasteName() End If End Sub --> </SCRIPT> <OBJECT ID="WebTWAIN2" CLASSID="CLSID:9779A3F5-EFF7-11D6-9AFF-0060085AA461" CODEBASE="WebTWAIN2.CAB#version=1,0,0,22"> </OBJECT> </TD> </TR> <TR> <TD> <INPUT TYPE=FILE SIZE=20 NAME="doc"> </TD> </TR> </TABLE> </FORM> </CENTER> </BODY> </HTML> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Downloads | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Revision History | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Build & Resource Information | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Disclaimer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This ActiveX Control is provided as is and without any guarantees or promises. You use it entirely at your own risk. It was written with care and was not designed to do anything clandestine or trojan like. It does nothing but try and talk to a TWAIN or Text source, convert an acquired image to a JPG or PDF and write the resulting file (named scanx.jpg, scanx.pdf or scanx.txt) to the directory as specified. However, it cannot be assumed to be bug or error free. You also cannot hold me responsible if it crashes your machine, corrupts your registry, destroys your Micosoft Visual Studio 6.0 SP5 (which it was built on). By using or distributing the control, you acknowledge to hold the author free of any claims arising from the use of the control or any other reason. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Contact Information | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This Webpage was written in a great hurry, so please don't judge the control on the appearance of this page. One day when I grow up, I'll make a decent page. But then, it is only a tiny page for an ActiveX Control, not a corporate PR page ;). If you wish to mail me any comments, feel free to do so at stefan@internext.co.za | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|