I’m trying to scan a paper with scanner and store it. I’m using C# , WIA , Kodak scaner i1310.
I get The remote procedure call failed(0x800706be) error when this line executes : var imageFile = (ImageFile)scannerItem.Transfer(FormatID.wiaFormatJPEG);
and here is my code :
private void btnScan1_Click(object sender, EventArgs e)
{
var deviceManager = new DeviceManager();
DeviceInfo firstScannerAvailable = null;
for (int i = 1; i <= deviceManager.DeviceInfos.Count; i++)
{
if (deviceManager.DeviceInfos[i].Type != WiaDeviceType.ScannerDeviceType)
{
continue;
}
firstScannerAvailable = deviceManager.DeviceInfos[i];
break;
}
var device = firstScannerAvailable.Connect();
var scannerItem = device.Items[1];
var imageFile = (ImageFile)scannerItem.Transfer(FormatID.wiaFormatJPEG);
var path = @"C:\Documents\scan.png";
if (File.Exists(path))
{
File.Delete(path);
}
imageFile.SaveFile(path);
}
can any body help me?
User contributions licensed under CC BY-SA 3.0