[sane-devel] TWAIN on SANE

Brian K. White brian@aljex.com
Sat, 14 Jun 2003 02:19:54 -0400

Stephen Williams wrote:
> priyag@newgen.co.in said:
>>I have an interface for scanner on TWAIN protocol for windows.  Now i
>>need to port it on the LINUX.  
> The TWAIN working group occasionally wonders about porting TWAIN to
> Linux, or defining a Linux variant of TWAIN. The former is iffy due
> to integration with the Windows message pump, and the latter comes
> with a lack of motivation from the involved parties.
> There is a SaneTWAIN datasource for Windows that allows Windows TWAIN
> apps access scanners over the network via SANE and the scanner's SANE
> driver, but I've not heard of any Linux version of that. If to write
> such a thing, the TWG might be interested.

I saw TWAIN on Linux at the AIIM show the year before this last one.
These people may know something about it:


Since the booth where I saw this had a guy from this company working it, I 
later went on to buy a copy of their twain library for a 
windows/unix/scanning project I was working on(1).


(1) text-based unix database app (written in filePro) sends a 
escape-sequence to either FacetWin or AnzioLite/AnzioWin terminal 
emulators to run a command.
command is like:
"aljex_scan P:/CompanyX/DocTypeY/DocNumZ-PageN.tif"
"aljex_scan P:/united/invc/129003-4.tif"

aljex_scan is hard-coded to scan a single sheet at fax-quality letter-size 
and output the file given on the command-line. P: is on the server thanks 
to FacetWin or Samba.

To view the scanned docs I made a pair of pretty simple cgi scripts. one 
shows a table of thumbnails of all images found with requested doctype & 
docnumber, click on a thumbnail and the other cgi script displays the 
image in a single img tage with witdh=100% so the "print" button on the 
web browser prints a full proper-size copy regardless what the window 
looks like. the unix app sends the "run-program" sequence to the terminal 
emulator, with an argument of:
"start http://server/cgi-bin/viewthm?encryptedjunk

where the cgi decrypts the query string and gets basically a path to the 
images minus the page numbers. this cgi generates a table of thumbnails 
and links where the link is the another cgi script and encrypted query 
string to view a particular page in full-size.

(both scripts are very light-weight, just ksh. no perl, but do use sort 
and ls)

The documents are given path & filenames based on the file & <some index> 
they are using within the app. The image viewer is just their web browser 
(images are converted to png, and png thumbnails generated on the server 
immediately after being saved). The scanner settings are all hard-coded in 
the little VB app I put on PC's that have scanners.

Voila. plain old unix app now has scanned documents, and users don't have 
to learn 10 minutes of new material to use it, since the "document 
management" is just piggybacked off the existing app that they already 
know how to navigate. Merely now some of their screens have a new hot-key 
& pull-down menu to "scan/view/fax/email/print/administer".

Brian K. White  --  brian@aljex.com  --  http://www.aljex.com/bkw/
filePro BBx  Linux SCO  Prosper/FACTS AutoCAD  #callahans Satriani