Help with web TWAIN demo

Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.

Moderator: Alex

Post Reply
smart+
Posts: 3
Joined: Fri Nov 12, 2010 1:26 am

Help with web TWAIN demo

Post by smart+ » Fri Nov 12, 2010 1:36 am

Hello,

I have purchased Vintasoft.NET Twain SDK and testing your examples.
I try modifying above example with new request (despeckle, deskew and detect border) which I
found in help, but don't know how can implement in this example.

Can you help me with this?

Best regards,
Sasa

Alex
Site Admin
Posts: 1474
Joined: Thu Jul 10, 2008 2:21 pm

Re: Help with web TWAIN demo

Post by Alex » Sat Nov 13, 2010 7:04 pm

Hello Sasa,

You should get a reference to acquired image object, for example as follows - device.AcquiredImages[0], and call Despeckle, Deskew, etc methods of the AcquiredImage class.

Best regards, Alexander

smart+
Posts: 3
Joined: Fri Nov 12, 2010 1:26 am

Re: Help with web TWAIN demo

Post by smart+ » Sat Nov 13, 2010 10:46 pm

Hello Alex,

I have no luck, please I need urgent help.

I changed this code in markup of .aspx page, but this not work:

Code: Select all

<script language="JavaScript" type="text/javascript">
function StartScan()
{
    // check that DeviceManager1 object is initialized properly
	if (DeviceManager1.IsTwainAvailable == null)
	{
	  document.getElementById('ErrorString').innerHTML = "<a href=http://www.vintasoft.com/vstwain-dotnet-faq.html#Web_DotNetSecurityError>Click here to see how to set the .NET Framework Security settings</a>";
	  alert("Your .NET Framework Security settings must be configured to run the components in your browser.");
	  return;
	}
	
	document.FormHttp.ScanImagesButton.disabled = 1;
	
	var imageCounter = 0;
	try
	{
	  // open the data source manager
	  DeviceManager1.Open();
	  // select the device
	  if (DeviceManager1.Devices.Select())
	  {
	    // get a reference to current device
  	    var device = DeviceManager1.Devices.Current;
  	    // enable/disable the User Interface of device
	    device.ShowUI = document.FormHttp.ShowUI.checked;
	    // store only one image in the internal buffer of device
	    device.AcquiredImages.Capacity = 1;
	    // gray

        // open the device
	    device.Open();
	    device.PixelType = 0;
	    
	    try
	    {
	      // specify how many images application wants to get from the device
	      if (document.FormHttp.ScanAll.checked == false)
	        device.XferCount = 1;
	      else
	        device.XferCount = -1;
	    }
	    catch (ex)
	    {
	    }
	      
	    // enable document feeder if necessary
	    if (device.IsFeederPresent)
	    {
	      try
	      {
	        device.DocumentFeeder.Enabled = document.FormHttp.Adf.checked;
	      }
	      catch (ex)
	      {
	        alert("Feeder cannot be enabled or disabled.");
	      }
	    }

        // acquire image(s) from the device
	    var acquireModalState;
	    var acquiredImage;
        var acquireStatusString = "Scan canceled";
	    do
	    {
	      acquireModalState = device.AcquireModal();
	      
	      // image acquired
	      if (acquireModalState == 2) 
	      {
	          // upload acquired image to the server
	          acquiredImage = device.AcquiredImages.Last;
	          acquiredImage = acquiredImage.Despeckle(8,25,30,400);
	          acquiredImage = acquiredImage.Deskew(0, 5, 5);
	          acquiredImage = acquiredImage.DetectBorder(5);

	          imageCounter = imageCounter + UploadToHttpServer(acquiredImage);
	      }
	      // scan completed
	      else if (acquireModalState == 3)
	          acquireStatusString = "Scan completed";

	      // scan failed
	      else if (acquireModalState == 4)
	          acquireStatusString = "Scan failed";

	      // scan canceled
	      else if (acquireModalState == 5)
	          acquireStatusString = "Scan canceled";
	    }
	    while (acquireModalState != 0)
	  }
	  
	}
	catch (ex)
	{
	  alert(ex.message);
	}
	finally
	{
      // disable the device if device is enabled
	  if (device.State == 2)
	    device.Disable();
	  // close the device if device is opened
	  if (device.State == 1)
	    device.Close();
	    
	  // scan process is finished
	  alert(acquireStatusString + ": " + imageCounter + " images are uploaded onto the server.");
	  
	  document.FormHttp.ScanImagesButton.disabled = 0;
	}
}
</script >
What I missing?
Where I must put "Vintasoft.Twain.dll" in ASP.NET (I put in root of my web application)?
Can I put this .dll in "Bin" folder?

Best regards,
Sasa

smart+
Posts: 3
Joined: Fri Nov 12, 2010 1:26 am

Re: Help with web TWAIN demo

Post by smart+ » Wed Nov 17, 2010 3:15 pm

Thank you for solution.
You can mark topic as solved.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests