scanline – Command-line Document Scanning for Mac OS X
I scan pretty much everything — bills, old photos, mortgage documents, tax stuff, etc. It can be tedious, but it makes finding things much easier when you need to remember whether you filed in 83(b) election in 2006 or what exactly the previous owners disclosed about the condition of the roof.
Having a good scanner with a document feeder helps a lot, but the standard scanning UI in Mac OS X isn’t exactly efficient for quickly scanning a whole bunch of stuff into labeled directories. What I really wanted was a way that I could just type out something quickly on the command line to control the scanner, but I couldn’t find anything out there. So I wrote scanline, which I’m now making available as an MIT-licensed open source project.
The basic way to use scanline is to just invoke it on the command line with no arguments (or hit up-arrow if you just scanned something previously):
airica:~ klep$ scanline
This will scan the current document(s) in the document feeder of the default scanner into ~/Documents/Archive/[year]/scan_[hms].pdf
But there’s a whole lot more you can do. scanline uses directories as labels, so if the document you’re scanning is your auto registration, you can specify that scanline should put it in the “car” directory:
airica:~ klep$ scanline car
This puts the document into ~/Documents/Archive/car/[year]/scan_[hms].pdf
If you also want your registration to show up in your directory for taxes (so you remember to deduct the VLF), you can specify multiple labels:
airica:~ klep$ scanline car taxes
This creates an alias of the scanned document in ~/Documents/Archive/taxes/[year]/scan_[hms].pdf in addition to the original in the car directory.
If it’s a double-sided document (and your scanner supports it), use -duplex to scan both sides:
airica:~ klep$ scanline -duplex car taxes
Want to scan from the flatbed scanner instead of the document feeder?
airica:~ klep$ scanline -flatbed
Want to scan into a different root directory instead of ~/Documents/Archive?
airica:~ klep$ scanline -dir ~/Desktop
Here’s a good one — got lots of items to scan on the flatbed but want them all put together into a single PDF?
airica:~ klep$ scanline -batch -flatbed
Want to name the document something that isn’t generic?
airica:~ klep$ scanline -flatbed -name registration car
The above command will scan the item on the flatbed into ~/Documents/Archive/car/[year]/registration.pdf
If you have multiple scanners connected to your computer, you can select them by name:
airica:~ klep$ scanline -scanner "Epson 565655"
If you’re not sure what scanners are available, list them:
airica:~ klep$ scanline -list
If you’d like to build scanline from source, enhance it, or tweak it for your needs, get it from:
If you just want the binary (it’s a debug build but plenty fast and stable for real use), you can download it here.
How It Works
scanline was created using the ImageCaptureCore framework. It uses Lumberjack for logging and XCTest/OCMock for unit tests. It’s my first Mac app in quite some time, so go easy on me if you look at the source.