Scanning to a Multi-Page PDF from Command Line
I never described how I do multi-page scanning but it is actually just a simple script. All the heavy-lifting is done by scanimage
that is actually doing very well. The script is only there to pass it the necessary options…
scanimage
doesn’t do PDF but it does multi-page scanning perfectly. I own an old Canon LiDE 20 and the fact that it can wait for a keypress before scanning the next page is very nice (lacking the automatic feeder).
|
|
What is going on here? First a check to see if files with names scanned.page-*.jpg
and scan.pdf
exist in the working directory and exit with an error if they do (else the script would overwrite them). Line 12 uses a tool from sane
package to find where exactly on the USB bus the scanner is today (the scanner reports its name as “CanoScan”); the last 7 characters on that line would be the address on the bus (xxx:xxx). We know the driver and the bus (line 13) so we can run scanimage
in multi-page mode with manual confirmation for each page right away. That’s actually what line 15 does. The page size is A4 (I usually scan pages of this size) and the optimal contrast has been experimentally selected for this particular scanner. Finally, convert
from the ImageMagick
package compiles the resulting JPEGs into a PDF.
After composing this script (quite some time ago) I promised to myself that I’d add command line options to choose file name or other parameters such as page size as soon as I need them. I haven’t yet felt such a need.
Reactions
фронтендер по скидке