-
Notifications
You must be signed in to change notification settings - Fork 0
/
scan
executable file
·29 lines (24 loc) · 842 Bytes
/
scan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# {c} GEL 2022
# scan from remove canon pixma scanner from the command line
# Setup - add the following line (uncommented) to /etc/sane.d/pixma.conf
# bjnp://192.168.29.94 # IP address of the scanner/printer
#device `pixma:MG2900_192.168.29.94' is a CANON Canon PIXMA MG2900 Series multi-function peripheral
if [ "$1" == "" ]; then
target="scan_"$(date +"%m-%d-%Y-%H%M%S")".png"
else
target="$1.png"
fi
targetpdf=`echo $target | sed "s/png/pdf/"`
#echo $target
dest=/Downloads/Pictures/Scans/$target
destpdf=/Downloads/Pictures/Scans/$targetpdf
scanimage --resolution 600 --mode Lineart -d "pixma:MG2900_192.168.29.92" -p -o $dest --format png
if [ "$?" == "1" ]; then
echo "Scan failed!"
exit;
fi
echo "Saved scan to $dest"
echo "Converting to pdf"
/usr/bin/convert $dest $destpdf
ls -la $dest $destpdf