Scannen auf Knopfdruck unter Linux

Dies ist wieder nur ein kurzes Gedächtnisprotokoll:

Unter folgenden Adressen habe ich eine Lösung gefunden, die zumindest teilweise für meinen Anwendungsfall funktioniert. Es ging um einen CanonScanner LiDE 40, wenn ich mich richtig erinnere.

Dann habe ich unter /etc/scanbuttond/buttonpressed.sh folgende Datei angelegt:

#!/bin/sh

# This script is started by scanbuttond whenever a scanner button has been pressed.
# Scanbuttond passes the following parameters to us:
# $1 ... the button number
# $2 ... the scanner's SANE device name, which comes in handy if there are two or 
#        more scanners. In this case we can pass the device name to SANE programs 
#        like scanimage.

# *** WARNING ***
# The example code below contains just simple examples how things may get done.
# Don't simply uncomment the code on systems with untrusted users!  This would
# make your button scanning vulnerable to various kinds of attacks by local users.
# *** WARNING ***

case $1 in
    1)
#         echo "button 1 has been pressed on $2"
#        scanimage --mode color -l 0 -t 0 -x 210 -y 296 --format tiff > /home/anwender/Schreibtisch/scan.tiff

                # Another example of the same action, but using other tools and
                # working with newer scanimage versions.
                # It requires sane-utils, lockfile-progs and netpbm.
                # Suggested by Francesco Potorti`.
                # 
#                 if ! lockfile-create --retry 2 $LOCKFILE; then
#                  echo "Error: scanning already in progress for $2"
#                   exit
#                 fi
#                 SCAN_OPTIONS="--resolution 300 --contrast 10 --brightness 0"
#                 scanimage --verbose --device-name $2 \
#                           --mode Gray -x 210 -y 297 $SCAN_OPTIONS |
#                   pnmtops -width=8.27 -height=11.69 |
#                   lpr -J $2 $PRINTER
#                 lockfile-remove $LOCKFILE
        ;;
    2)
#        echo "button 2 has been pressed on $2"
        scanimage --resolution 300 --mode gray -l 0 -t 0 -x 210 -y 296 --format tiff > /home/anwender/Schreibtisch/scan.tiff
        tiff2ps -z -w 8.27 -h 11.69 /home/anwender/Schreibtisch/scan.tiff | lpr
        rm /home/anwender/Schreibtisch/scan.tiff
        # flegita
        ;;
    3)
        echo "button 3 has been pressed on $2"
        # scanimage --resolution 300 --device-name $2 --mode Color -x 210 -y 297 | pnmtops -width=8.27 -height=11.69 > $TMPFILE_PS
        # ps2pdf $TMPFILE_PS $TMPFILE_PDF
        # evince $TMPFILE_PDF
        ;;
    4)
        echo "button 4 has been pressed on $2"
                # scanimage --resolution 300 --device-name $2 --mode Color -x 210 -y 297 | pnmtops -width=8.27 -height=11.69 > $TMPFILE_PS
        # ps2pdf $TMPFILE_PS $TMPFILE_PDF
                # nautilus-sendto $TMPFILE_PDF
        ;;
esac

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Seite verwendet Cookies, um die Nutzerfreundlichkeit zu verbessern. Mit der weiteren Verwendung stimmst du dem zu.

Datenschutzerklärung