aboutsummarylogtreecommitdiffstats
path: root/foofilter
blob: 7fadd3d3e9a06d9f31913689c39aeac0d8f65b5e (plain)
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
34
35
#!/bin/sh
#
# foofilter.sh -- Foomatic-rip-lprng is used as the print filter
#
infile=/tmp/infile.$$
tempfile=/tmp/tempfile.$$

# replace example.ppd with the appropriate ppd file for your printer
your_ppd=$example.ppd

cat > $infile

fileinfo=`file -b $infile`
ascii=`echo $fileinfo | grep ASCII`
pdf=`echo $fileinfo | grep PDF`
ps=`echo $fileinfo | grep PostScript`

if test "$ascii" != ''
then
    enscript -M Letter -o - $infile > $tempfile
elif test "$pdf" != ''
then
    pdftops $infile - > $tempfile
elif test "$ps" != ''
then
    cat $infile > $tempfile
else
    echo "Can not print file of type  $fileinfo" | \
	enscript -M Letter -o - > $tempfile
fi

# foomatic-rip sends stuff to the standard output
/usr/bin/foomatic-rip-lprng --lprng /etc/lprng/lpd/$your_ppd < $tempfile

rm $infile $tempfile