There are 2 ways:
1) Twain
2) ISIS
These are common interfaces to work with scanners.