Scanning duplex with scanimage

A while back I bought a small Brother DS-740D to set up some automation for document scanning. The plan was that I would make it automatically scan all pages of a document I fed in and when I confirmed it was done, would create a PDF and send to my paperless-ngx instance.

Unfortunately I hit and issue early on, I couldn’t find a solid way to scan duplex using the CLI. After countless days searching “how to scan duplex with scanimage” I kept seeing the same sorts of results appearing:

--source "Automatic Document Feeder"

and

--source "ADF Duplex"

But to no avail trying these.

Which is when I decided to do this the normal way. Looking out the output of scanimage -h I noticed the flag of “-A” to show options.

https://man.archlinux.org/man/scanimage.1.en#A

After running it gave an output showing all available options of this scanner. Of which, for the section showing the possible source options showed the following:

TODO; update with the output of -A

“Automatic Document Feeder(left aligned,Duplex)” This string I had not seen before, nor had I realised that these are somewhat scanner specific strings. Combining this with the —batch flag IT WORKED!

The final result:

scanimage --format tiff --source "Automatic Document Feeder(left aligned,Duplex)" --batch=$(date +%Y%m%d_%H%M%S)_p%04d.tiff --resolution 300 --AutoDocumentSize=yes --AutoDeskew=yes

TL;DR

Read the documentation provided, realised scanimage -A tells you everything down to the specific string you need to put in for source, tailed to what your scanner is capable of. Makes life 100x easier.