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 a开发者_如何学Govoid 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?
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/
精彩评论