Scanning woes dispelled

Once again I found myself in a situation where I had to print a document, sign it, scan it and return it as PDF. Being a Linux user and owning a scanner/printer/fax that is largely unsupported (Canon Pixma MP780), I’ve usually ended up using the nifty scan to PDF scanner at work. However the scanner feature of the Pixma is to some extent supported using pixma_scan. (The printer works using TurboPrint). So I figured it should be possible to somehow merge the PNM files the scanner program produces into a multi-page document and convert this to PDF.

Google revealed that quite a few people have asked similar questions but no answers provided a complete solution. So I set about to write a bash script that would save me the hassle next time:

The script will use the automatic document feeder, does not care about document size and is quite simple. But it does the job. Most of the tools here (except pixma_scan) should be readily available in your favourite distro.