Scanner + Printer = Copy Machine

Multi-functional printer is just a combination of printer and scanner.
So, why don’t you make DIY copy machine in Linux if you have a printer and scanner?
Make sure your scanner is supported in SANE in Linux, and install scanbuttond for scanner’s button control.
scanbuttond seems no longer in active development, but it works OK in CentOS.

I added these commands in /usr/local/etc/buttonpressed.sh as follows:

In the button pressed event,

scanimage --mode lineart --resolution 300 -x 215 -y 297 > test.pnm
pnmtops -scale 1000 -dpi 300 test.pnm | lpr -PHL-2040
convert test.pnm /some/archive/`date + %Y%m%d%H%M`.pdf

So, whenever I press the button, it automatically starts scanning, then prints it out and archives as PDF.
The only thing that bugs me is the slow scanning time…