Scanning Options
- TWAIN, the old cross platform interface. See TWAIN functions for FileMaker and our TWAIN plugin part in the MBS Xojo Images Plugin.
- ImageCapture, the interface provided by Apple and used by Image Capture.app. See ImageCapture functions for FileMaker and our ImageCapture plugin part in the MBS Xojo MacOSX Plugin.
- WIA, the Windows Image Acquisition API from Microsoft. See WIA functions for FileMaker and our WIA plugin part in the MBS Xojo Win Plugin.
To select the feeder, you would use ImageCapture.requestSelectFunctionalUnit early to request the DocumentFeeder as functional unit, before setting up other parameters. For WIA, you would later when requesting the scan pass Feeder as the item to use for WIA.Scan function. For TWAIN you need to enable feeder with Twain.SetFeededEnabled and enable auto feeding with Twain.SetAutofeed function. If used correctly, you should be able to scan a stack of papers on your scanner.
But before scanning, you may want to set a few options. For the feeder, you may want to enable duplex. To do this for TWAIN, you call Twain.SetDuplexEnabled passing 1 to enable duplex mode. For ImageCapture, you need to use ImageCapture.SetParameter with the duplexScanningEnabled property and the value 1. And for WIA, it is the WIA.SetItemPropertyValue function with the property named "Document Handling Select". Usually you pass a combination of values including 4 for duplex. You may also include 256 for preferred automatic selection or +512 for auto advance. The specs also allow to specify 8 for front page first, but may scanner here doesn't recognize that and returns an error. It's always good to double check and query the value you set to verify what was saved.
Next you may want to define resolution for the scan. Usually most scanners can interpolate in hardware if needed, but asking for a common resolution of 150 or 300 dpi may simply be okay for most scanners. For ImageCapture you call ImageCapture.SetParameter with parameter resolution and value 300. For WIA, you may need to call WIA.SetItemPropertyValue several times. First for item Feeder as well as item Flatbed, than for properties "Horizontal Resolution" and "Vertical Resolution" to set both. For TWAIN you call Twain.SetResolutionX and Twain.SetResolutionY to set the resolution. As said, 300 dpi usually works. But we have seen scanners which can do 200 and 100 dpi, but not 150 dpi. For ImageCapture, you can use ImageCapture.GetParameter with parameter nativeXResolution and nativeYResolution to query native resolution, preferredResolutions to query preferred resolution and supportedResolutions for a list of supporters resolutions. With WIA, the WIA.DevicePropertyValue function can query the "Vertical Optical Resolution" to let you know the native resolution.
If you scan only for OCR, you may just limit it to be black and white or grayscale. For ImageCapture, you can use ImageCapture.SetParameter to set pixelDataType to gray and bitDepth to 8 to get a 8bit grayscale image file. With WIA, you can use WIA.SetItemPropertyValue to set the item's current intent property to 2 for grayscale. For TWAIN, you would use Twain.SetPixelType to pass 1 for grayscale images.
For all three variants, you can scan with dialog and see options as well as define defaults for your scanner. That may be more convenient for some users to simply use the dialogs.
The options above are listed as MBS FileMaker Plugin calls, but for Xojo the properties are named similar and values are the same. So if you have problems translating this, let me know. And if you miss an option, please let us know. We may be able to add more options to documentation in examples.