Created
August 5, 2012 08:49
-
-
Save sunix/3263040 to your computer and use it in GitHub Desktop.
My Brother brscan scanner S-KEY tool scan to file script. Scan from ADF, convert to PDF and merge PDFs files into a single one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
set +o noclobber | |
# | |
# $1 = scanner device | |
# $2 = friendly name | |
# | |
# | |
# 100,200,300,400,600 | |
# | |
resolution=200 | |
device=$1 | |
BASE=~/brscan | |
mkdir -p $BASE | |
if [ "`which usleep 2>/dev/null `" != '' ];then | |
usleep 10000 | |
else | |
sleep 0.01 | |
fi | |
output_tmp=$BASE/$(date +"%Y-%m-%d_%Hh%M") | |
echo "scan from $2($device)" | |
scanimage --device-name "$device" --resolution $resolution --batch="$output_tmp"_%04d.tiff --format=tiff -x 210 -y 297 | |
for tifffile in $(ls "$output_tmp"*) | |
do | |
tiffcp -c lzw "$tifffile" "$tifffile".lzw.tiff | |
tiff2pdf "$tifffile".lzw.tiff > "$tifffile".pdf | |
rm -f "$tifffile" | |
rm -f "$tifffile".lzw.tiff | |
done | |
pdftk $output_tmp*.pdf cat output "$output_tmp".pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This just saved me several hours of screwing around with the original
scantofile.sh
to get it to generate PDF files. Thank you for sharing!