0
votes

I can't access/find the duplex property / setting on my scanner via Powershell and via WIA 2.0 .

I 've installed the correct drivers but it seems, that alot of properties are missing (see below).

Am I reading from the wrong device properties? -> device.Properties["Document Handling Select"] = 5 (found here WIA 2.0 Duplex scanning ).

The scanner scans both pages in 1 turn (double-sided scan).

Tried several "fixes" of other questions, including calling the image item.transfer twice - doesn't provide the backpage though.

What works:

  • Everything, including scanning a page and saving it into a .tiff file

What doesn't work:

  • Duplex - I 've searched millions of sites, WIA 2.0 documentation, but I can't seem to find the right property to set the device.Properties["Document Handling Select"] = 5 (found here WIA 2.0 Duplex scanning )
  • The Scanner is Duplex and works with duplex in every standard scan setting

Powershell snippet

While ($true) {
"in While"
Try{

$deviceManager = new-object -ComObject WIA.DeviceManager
"Devices: " + $deviceManager.DeviceInfos.Count()
$device = $deviceManager.DeviceInfos.Item(1).Connect()

} catch {
    "while break"
    $error
    break 
}

$x = 1
while ($x -lt 17){

$device.Properties($x)
$x = $x + 1
}

$imageProcess = new-object -ComObject WIA.ImageProcess

$wiaFormatTIFF = "{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}"

foreach ($item in $device.Items) {
    "device items: " + $device.Items.Count
    $image = $item.Transfer($wiaFormatTIFF)
    $imageback = $item.Transfer($wiaFormatTIFF)

Property output

Properties output of Powershell device properties over USB:

Name           : User Name
PropertyID     : 3112
Type           : 16
IsReadOnly     : True
IsVector       : False
SubType        : 0
SubTypeDefault :
SubTypeValues  :
SubTypeMin     :
SubTypeMax     :
SubTypeStep    :

Value          : Root
Name           : Item Name
PropertyID     : 4098
Type           : 16
IsReadOnly     : True
IsVector       : False
SubType        : 0
SubTypeDefault :
SubTypeValues  :
SubTypeMin     :
SubTypeMax     :
SubTypeStep    :

Value          : 0001\Root
Name           : Full Item Name
PropertyID     : 4099
Type           : 16
IsReadOnly     : True
IsVector       : False
SubType        : 0
SubTypeDefault :
SubTypeValues  :
SubTypeMin     :
SubTypeMax     :
SubTypeStep    :

Value          : 76
Name           : Item Flags
PropertyID     : 4101
Type           : 5
IsReadOnly     : True
IsVector       : False
SubType        : 0
SubTypeDefault :
SubTypeValues  :
SubTypeMin     :
SubTypeMax     :
SubTypeStep    :

Value          : {6BDD1FC6-810F-11D0-BEC7-08002BE2092F}\0001
Name           : Unique Device ID
PropertyID     : 2
Type           : 16
IsReadOnly     : False
IsVector       : False
SubType        : 0
SubTypeDefault :
SubTypeValues  :
SubTypeMin     :
SubTypeMax     :
SubTypeStep    :

Value          : CANON
Name           : Manufacturer
PropertyID     : 3
Type           : 16
IsReadOnly     : True
IsVector       : False
SubType        : 0
SubTypeDefault :
SubTypeValues  :
SubTypeMin     :
SubTypeMax     :
SubTypeStep    :

Value          : CANON DR-M140 USB
Name           : Description
PropertyID     : 4
Type           : 16
IsReadOnly     : True
IsVector       : False
SubType        : 0
SubTypeDefault :
SubTypeValues  :
SubTypeMin     :
SubTypeMax     :
SubTypeStep    :

Value          : 65536
Name           : Type
PropertyID     : 5
Type           : 5
IsReadOnly     : True
IsVector       : False
SubType        : 0
SubTypeDefault :
SubTypeValues  :
SubTypeMin     :
SubTypeMax     :
SubTypeStep    :

Value          : \\.\Usbscan4
Name           : Port
PropertyID     : 6
Type           : 16
IsReadOnly     : True
IsVector       : False
SubType        : 0
SubTypeDefault :
SubTypeValues  :
SubTypeMin     :
SubTypeMax     :
SubTypeStep    :

Value          : CANON DR-M140 USB
Name           : Name
PropertyID     : 7
Type           : 16
IsReadOnly     : True
IsVector       : False
SubType        : 0
SubTypeDefault :
SubTypeValues  :
SubTypeMin     :
SubTypeMax     :
SubTypeStep    :

Value          : local
Name           : Server
PropertyID     : 8
Type           : 16
IsReadOnly     : False
IsVector       : False
SubType        : 0
SubTypeDefault :
SubTypeValues  :
SubTypeMin     :
SubTypeMax     :
SubTypeStep    :

Value          :
Name           : Remote Device ID
PropertyID     : 9
Type           : 16
IsReadOnly     : False
IsVector       : False
SubType        : 0
SubTypeDefault :
SubTypeValues  :
SubTypeMin     :
SubTypeMax     :
SubTypeStep    :

Value          : {B763D1FD-94C8-4ef6-B5E8-E7F3086CF161}
Name           : UI Class ID
PropertyID     : 10
Type           : 16
IsReadOnly     : True
IsVector       : False
SubType        : 0
SubTypeDefault :
SubTypeValues  :
SubTypeMin     :
SubTypeMax     :
SubTypeStep    :

Value          : 0
Name           : Hardware Configuration
PropertyID     : 11
Type           : 5
IsReadOnly     : True
IsVector       : False
SubType        : 0
SubTypeDefault :
SubTypeValues  :
SubTypeMin     :
SubTypeMax     :
SubTypeStep    :

Value          :
Name           : BaudRate
PropertyID     : 12
Type           : 16
IsReadOnly     : True
IsVector       : False
SubType        : 0
SubTypeDefault :
SubTypeValues  :
SubTypeMin     :
SubTypeMax     :
SubTypeStep    :

Value          : 19
Name           : STI Generic Capabilities
PropertyID     : 13
Type           : 5
IsReadOnly     : True
IsVector       : False
SubType        : 0
SubTypeDefault :
SubTypeValues  :
SubTypeMin     :
SubTypeMax     :
SubTypeStep    :

device items: 1
1

1 Answers

0
votes

Okay, actually the scanner didn't have the property for duplex, while beeing duplex. Tried it with another scanner and with that property it works.

Try {   
    "device items: " + $device.Items.Count

    $device.Properties["3088"].Value = 5 <--- Duplex property 5, ID 3088
    $device.Properties["3087"].Value
    $imageback = $item.Transfer($wiaFormatTIFF)

} catch {
    "while break"
    $error
    $killwhile = 1
    break 
}