[office] scantopdf
Another addition to my [office] collection of scripts. And again one which
deals with a scanner. scantopdf scans an A4 paper from any SANE device and
stores it as a PDf with a given filename.
#!/bin/sh
# scans an A4 image and saves it as a pdf file with given filename
colourmode="Gray"
depth=8
resolution=300
while getopts cd:r: option
do
case $option in
c) colourmode="Color";;
d) depth=${OPTARG};;
r) resolution=${OPTARG};;
?) printf "Usage: %s [-c] [-d depth] [-r resolution] filename.pdf\n" $0
exit 2;;
esac
done
shift $(($OPTIND - 1))
/usr/bin/scanimage --mode=${colourmode} --depth=${depth} \
--resolution ${resolution} -x 215 -y 297 \
| /usr/bin/pnmtops -noshowpage -equalpixels -dpi=${resolution} \
| /usr/bin/ps2pdf -sPAPERSIZE=a4 - "$*"
[...] the airport. Bored. Started hacking up my scantopdf script to cater for multiple page documents and a simple [...]