summaryrefslogtreecommitdiff
path: root/bin/pdfscan
blob: 5b71b30a5d57674b616817b9d3af99a62da1789a (plain) (blame)
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
29
30
31
32
33
#!/bin/sh
 
usage()
{
echo "Usage: pdfscan [Lineart|Gray|Color] [resolution] <nameofimage>"
}

#test to see if the mode and a filename have been entered
if [ $# -lt 3 ] ; then usage ; exit 1 ; fi
mode=$1
resolution=$2
name=$3

#read output of help command to get scanner device name
#scanner=`scanimage --help | tail --lines=1 `

echo Now scanning your A4 document to pdf
#echo Now scanning your A4 document on $scanner

#scan the A4 binary(b&w) file uncompressed at 300dpi to temporary file
#scanimage -d $scanner \
scanimage \
    --mode $mode \
    -x 210 -y 296 \
    --resolution $resolution \
    --format=tiff > temp-$name.tif

#convert to pdf with G4 compression
tiff2pdf temp-$name.tif -p A4 -q G4 -o $name.pdf
rm temp-$name.tif

#display pdf
okular $name.pdf

Contact - Imprint