Simple scanning library for F# built on top of WIA. The goal of this library is to make basic scanning operations simple, but still allow easy access to the underlying WIA interface.
Keep in mind this is still work in progress.
Basic scanning with custom settings:
let scanner = DeviceManager().ConnectedScanners() |> Seq.head
let imageSource = scanner.ImageSources() |> Seq.head
let settings = { imageSource.Settings with
colorMode = ColorMode.BlackAndWhite;
verticalResolution = 300;
horizontalResolution = 300; }
imageSource.ScanWithSettings settingsListen for events related to scanning:
let deviceManager = DeviceManager()
let scannerConnected =
deviceManager.RegisterScannerConnected (
fun scanner ->
printfn "A new scanner was connected: %s"
scanner.Properties.name)
// ...
deviceManager.UnregisterEvent scannerConnectedSet additional WIA properties yourself:
let scanner = DeviceManager().ConnectedScanners() |> Seq.head
scanner.SetProperty 3100 1Show system dialogs:
let scanner = DeviceManager().ScannerSelectDialog()
let source = scanner.ItemSelectDialog() |> Seq.head
let image = source.ScanProgressDialog()
imageAccess WIA objects directly:
let wiaManager = DeviceManager().__WiaDeviceManager
let deviceInfo = wiaManager.DeviceInfos.[ref (1 :> obj)]
if deviceInfo.Type = WIA.WiaDeviceType.ScannerDeviceType
then deviceInfo.DeviceID
else "Device is not a scanner."