Scanning documents with the GT-S50

You might remember that a couple of months ago I bought a high-end scanner for my ongoing mission to make my office as paperless as humanly possible to me.

In due time, I also replaced my previous scan2pdf sh script with something a bit more reliable, written in Ruby. The original reason was that the options supported by the four scanners I have worked with up to now – an Epson Perfection 2480/2580, a HP OfficeJet MFP with a “fake feeder”, a HP LaserJet network MFP, and now the GT-S50 – varied considerably, and I needed something that would actually allow me to choose the options to pass depending on the device itself. The end result is a Ruby script scan2pdf which is still not implementing all I wished for, but it comes much nearer than what I used before.

One of the most recent features came from a requirement I found when trying to get rid of some legal paperwork from some years ago: for whatever reason, in Italy, a number of legally-binding papers seem to still be printed and set in folded sheets (what is usually called foglio protocollo in Italian); this means that you got a single A3-sized sheet, folded in the middle to provide four A4-sized sides to write on. And actually cutting this down to reduce it to two A4 sheets is not an option. How do you scan that?

With a standard flatbed scanner it is relatively easy to scan it: you just scan the four sides one by one. On a sheet-fed scanner like the GT-S50, you can’t do so unless you use the plastic envelope that they give you, which allows to scan irregularly-shaped sheets. And even doing so, it is a bit of a problem because you either have to run four scans, or you have to interleave the external and internal sides. So the end result was implementing a --folded switch to the script, and there you go.

What I’m missing now is some kind of “presets” system, so that I don’t have to repeat the same options each time when I’m doing common scans: a folded scan requires me to use the envelope, which in turn means that the first 20mm of the scan need to be discarded (as it’s the envelope’s detection zone). And all the scans from the GT-S50 (as well as the Perfection 2580) are to be done in the middle-area, rather than starting from the far left or right (as it was done, instead, on the HP MFPs.

For this one, I’m actually open to suggestions: do anybody know a decent Ruby library to handle ini-style configuration files? I’m not keen on using YAML here, not only because I can’t stand the format, but also because it seems more natural to keep using the key/value pair files when there is no need for anything particularly complicated (multiple sections are welcome for presets themselves).