2012-02-09 72 views
0

我正在編寫一個程序,通過WIA與網絡掃描儀一起工作。 當只掃描一頁時,一切正常。當我打開進紙器:WIA +網絡掃描儀,adf = 1頁

foreach (WIA.Property deviceProperty in wia.Properties) 
{ 
    if (deviceProperty.Name == "Document Handling Select") 
    { 
     int value = duplex ? 0x004 : 0x001; 
     deviceProperty.set_Value(value); 
    } 
} 

程序接收掃描,仍有在饋線文檔和COM錯誤脫落(掃描儀繼續掃描)信號。 下面的代碼檢查頁進紙器:

//determine if there are any more pages waiting 
Property documentHandlingSelect = null; 
Property documentHandlingStatus = null; 

foreach (Property prop in wia.Properties) 
{ 
    if (prop.PropertyID == WIA_PROPERTIES.WIA_DPS_DOCUMENT_HANDLING_SELECT) 
     documentHandlingSelect = prop; 
    if (prop.PropertyID == WIA_PROPERTIES.WIA_DPS_DOCUMENT_HANDLING_STATUS) 
     documentHandlingStatus = prop; 
} 

if ((Convert.ToUInt32(documentHandlingSelect.get_Value()) & 0x00000001) != 0) 
{ 
    return ((Convert.ToUInt32(documentHandlingStatus.get_Value()) & 0x00000001) != 0); 
} 

return false; 

獲取圖片代碼:

imgFile = (ImageFile)WiaCommonDialog.ShowTransfer(item, wiaFormatJPEG, false); 

可惜找不到使用WIA WSD的例子。也許有一些設置可以通過WSD獲取多個圖像。

+0

我也有[相同的問題](http://stackoverflow.com/questions/27473142/cannot-read-second-page-scanned-via-adf/31908751#31908751),我通過安裝製造商的驅動程序解決。 – 2015-08-09 21:07:21

回答

0

我幾乎使用WIA 2.0與vba控制Brother MFC-5895CW多功能掃描儀的問題。 當我從ADF轉移掃描時,我無法將超過2張圖片捕捉到圖像對象(並且我嘗試了所有現有選項,並且在這個問題上花費了幾天甚至幾小時!) 我發現該掃描儀的唯一解決方案是使用WIA.CommonDialog對象的ShowAcquisitionWizard方法批量傳輸所有掃描的文件到指定的文件夾。對我而言,這是一種比解決方案更好的解決方法,因爲後處理會變得更加複雜。

令人驚訝的是,我在我的客戶端整潔掃描儀上嘗試了相同的過程... ShowAcquisitionWizard僅向指定的文件夾發送了一個掃描頁面,其他頁面消失。 通過'CommonDialog.ShowTransfer'方法讓我第二次驚喜,我能夠將所有掃描的文檔逐圖傳輸到應用程序中的圖像對象中。

+0

我從MS支持獲得的唯一解決方案是 - 「您必須爲WIA COM API編寫自己的包裝」... – 2012-02-29 11:37:25