I would like to be able to scan ID cards into my database. My Xojo app is used 99% on MacOS.
I don’t really care about the format (ie. jpg, gif, pdf) just as long as they are readable.
Is it possible to scan directly into a Xojo app from a Fujitsu ScanSnap scanner? It would be nice to just click a button in Xojo and the image gets processed.
I have been using Photo Booth to take pictures which I drag into a canvas on a window. I hex encode the image and then upload it to a Postgres database (this always works great on Mac but whenever I decode the hex to view it on a PC, it can frequently crash the application so I had to disable it).
Can I scan to a folder and when Xojo sees a new file in the folder, then import it?
I use the MBS Twain class for this. MBS provides sample programs demonstrating its use.
I read somewhere that twain is no longer working in Sierra
use the fantastic free example from Axel Schneider here:
https://forum.xojo.com/26909-old-scanner
A lot of document scanners like the ScanSnap have no drivers for macOS, so it’s not possible to scan directly into Xojo. A lot of these document scanners have also no scriptable software on board. In such a case we use ExactScan Pro (http://exactscan.com). This tool provide native access to a lot of scanners in macOS. You can start the scan process with some settings with an apple script from Xojo:
Example from ExactScan:
tell application "ExactScan Pro"
-- define a profile
set profile to 1 -- profile, usually maps to scanner buttons
set profile name to "Invoices"
set resolution to 240
set AppName to path to application "Preview" -- target application to notify
set destination app to POSIX path of AppName
set document type to "Color" -- Gray, Lineart, Dithered,
set tmpFolder to path to temporary items folder from user domain
set destination folder to POSIX path of tmpFolder
set destination file to "Invoice-1234"
show window -- show the main window on screen
scan -- start the scan
end tell
That made me do some web searches, and it appears to me that it may be vendor specific for whether they provide a TWAIN driver or not. For example see the Brother page which lists a TWAIN driver even for High Sierra, at least for certain models.
Realized I didn’t respond to the last question either. If your scanner can simply save to a designated folder, then you can watch that folder. I use this class from MBS .
MBS Plugins support ImageCapture API on mac so you can scan without TWAIN.
If I have a working solution using the TWAIN plugin and scanners with a TWAIN driver, is there an advantage to moving to ImageCapture?
When you buy new scanners it is easier to get driver for image capture
On OS X / macOS, I use Preview (outside of any Xojo application) to make my scans. It allows save on multiple formats (png, jpd, tif
).
This may be a solution.
I use a Canon document scanner to send documents (and yes, also ID cards!) directly into a Xojo desktop app.
https://vimeo.com/182838750
As I understood, David asked for implementing the Fujitsu ScanSnap into a Xojo workflow. The ScanSnap comes with proprietary scan software only and without apple script capabilities. No native drivers are available for macOS. So you have no chance to use the ScanSnap with preview.app, image capture / ICScannerDeviceMBS, Twain-Software etc.
In my experience, you have three choices:
- try to watch the ScanSnap export folder (e.g. FSEventsMBS, this may not work with network folders)
- use external software like ExactScan
- or buy a document scanner with native macOS support
(native = I’m talking about a scanner that you can use with macOS preview.app / ICScannerDeviceMBS)
I am happy to report that every scanner working in Image Capture app from Apple on macOS should also work with our plugin.
Please note that we have 4 ways to scan in MBS Plugin:
- TWAIN classes for Mac and Win: TWAIN in Picture Plugin
- Newer ImageCapture classes: ImageCapture in AVFoundation Plugin
- Older ImageCapture classes (no longer recommended): ImageCapture in MacOSX plugin.
- WIA classes for Windows: WIA in Win Plugin
the fujitsu scansnap comes with a mac app, where you can save to a folder automatically.
so scanning a designed folder for comming jpeg or pdf and opening them is not that difficult ?