Posted in: Linux

Editing Brother scantofile

I’m editing the scantofile for my new Brother DCP Scanner.  Hard Work searching the information.

———-
#! /bin/sh
set +o noclobber
#
#   $1 = scanner device
#   $2 = friendly name
#

#  
#       100,200,300,400,600
#
resolution=200
device=$1
BASE=$HOME/Documents/BrScan
mkdir -p $BASE
if [ “`which usleep  2>/dev/null `” != ” ];then
    usleep 1000000
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

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH -dDetectDuplicateImages -dCompressFonts=true -r150 -sOutputFile=”$output_tmp”.pdf $output_tmp*.pdf

rm -f “$output_tmp”*tiff*
———-

Ref. http://www.jduck.net/blog/2008/01/05/ocr-scanning/
https://gist.github.com/sunix/3263040
http://stackoverflow.com/questions/2507766/merge-convert-multiple-pdf-files-into-one-pdf

Back to Top