#! /bin/sh SCANNER="genesys:libusb:002:002" TXTLANG="eng" EDITOR="gedit" echo -n "Project Name: "; read PROJECT if [ -z $PROJECT ]; then exit fi scanimage -d $SCANNER --batch --batch-start 10000 --batch-prompt --resolution 600 --mode lineart --format=tiff for TIF in out*.tif; do echo "Reading $TIF" TXT=$TIF.tif.txt tesseract $TIF $TXT -l $TXTLANG done cat *.txt >> $PROJECT.txt $EDITOR $PROJECT.txt PAGES=$(ls -l out*.tif | wc -l) for TIF in out*.tif; do echo "Converting $TIF" PDF=$TIF.tif.pdf if [ "$TIF" = "out10000.tif" ]; then convert $TIF output.pdf else convert $TIF $PDF pdftk A=output.pdf B=$PDF CAT A B output output-1.pdf mv output-1.pdf output.pdf fi done recode UTF8..ISO-8859-15 $PROJECT.txt a2ps -o $PROJECT.ps $PROJECT.txt ps2pdf14 $PROJECT.ps $PROJECT-text.pdf pdftk A=output.pdf B=$PROJECT-text.pdf CAT A B output $PROJECT.pdf okular $PROJECT.pdf echo -n "Delete auxiliary files ? (j) "; read delete if [ "$delete" = "j" ]; then rm $project.ps rm out*.tif rm out*.pdf rm out*.txt rm output.pdf rm $output-text.pdf rm *~ fi