1

I am working on a web application that is a pretty simple and straightforward application except for on thing: it needs to be able to get documents from the scanner. I don't want to force the user to scan documents manually, save them, and then browse to them to upload the file, and I would like to avoid Active-X if possible (though feel free to make recommendations that include active-x). Is there a good way to do this through a web app? Can silverlight access scanners?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Max Schmeling
  • 12,363
  • 14
  • 66
  • 109

1 Answers1

2

You can do this with Silverlight 4.

<Button x:Name="btnAquireImage" Content="Aquire Image from Scanner/Camera" Click="btnAquireImage_Click" />


private void btnAquireImage_Click(object sender, RoutedEventArgs e)
{
   using (dynamic CommonDialog = ComAutomationFactory.CreateObject("WIA.CommonDialog"))
   {
       dynamic imageFile = CommonDialog.ShowAcquireImage();
       if (imageFile != null)
       {
           //insert file upload code
       }
   }
}

Source: http://www.brianlagunas.com/index.php/2010/02/19/silverlight-4-accessing-system-devices-with-com-interop/

Sean Hill
  • 14,978
  • 2
  • 50
  • 56
  • I appreciate this answer. It may be what I end up doing, but I'm hoping to find a way that doesn't require the user to run out of browser. (I'm not hopeful that I will find a way, however) – Max Schmeling Nov 11 '10 at 21:05
  • Honestly, I don't think you will find anything that will work other than custom plugins that will only work with certain browsers. At least with Silverlight, you have cross browser compatibility. – Sean Hill Nov 12 '10 at 13:58