This page is just a sample scanning page, that has TwainX declared but in silent (stealth) mode.
Please see the sample code for this page below and click on the buttons to see it in action. for the time being please allow this component to run by both adding twainx.sourceforge.net to your trusted sites. Also relax the security settings so as to momentarily allow the "download unsigned ActiveX" in your security tab of Internet Explorer. we plan to digitally sign a furture release of TwainX
1. Quick Test: this demonstrates how to invoke scanner in two lines (expanded a bit for clarity purposes).
2. Force scanner selection: by default, the first time TwainX runs on the client machine it will prompt the user to select a twain source and then it will save his/her selection for future reference into the Registry. if, however, you would like to force a prompt to select the scanning device again, you can use this sample.
.This simple done is just two steps away:
1. Declare TwainX in your page
<OBJECT id="TwainX" name="TwainX" classid="clsid:61EC4ECB-81B6-4309-B7B5-8F7755830EEF" codebase="ScanProj.cab#version=1,0,16,1" width="5" height="5"> </OBJECT>
2. Declare a Javascript function to call it, and hook it to an event of your choice
function ScanSomeRegions(){ try { //TwainX.config (x_resolution, y_resolution, bit_depth_index, // user_can_crop, user_can_resize, client_temp_directory, // registy_key , interactive_mode, debug_mode); TwainX.config (150, 150, 2, 1, 1, "c:/", "my_product", 1, 1); //TwainX.scanRegions(temp_directory, region_defintion_string, // interactive, registry_key, debug_mode); TwainX.scanRegions( "c:/", "145,360,200,250,region1.jpg,24,30,5300#"+ "105,735,370,75,region2.jpg,24,100,2048", 0, "param4", 0); }catch (e){ //alert("scanner error"); } }And on the Button, the code to call this javascript function would be as simple as:
<input type="submit" name="Submit" value="Quick Scan" onclick="ScanSomeRegions(); return false;"/>