summaryrefslogtreecommitdiffstats
path: root/debian/htdig/htdig-3.2.0b6/debian/htdig-pdfparser
blob: c9d7699699dd9e39b9f6115ec7fb7bebe24c2207 (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
36
37
#!/bin/sh

# Wrapper script for the ht://Dig PDF parser engine
#
# This script is called by the htdig binary to parse pdf documents
# Set the debian_pdf_parsed in the htdig configuration
# 
# 
# Written by Stijn de Bekker <stijn@debian.org> for Debian GNU/Linux.


#PARSER=`grep debian_pdf_parser /etc/htdig/htdig.conf | awk '{ print $2 }'
# replaced with the following line, suggestion by pod, should fix #196916
PARSER=`awk '/^debian_pdf_parser:/{ print $2 }' /etc/htdig/htdig.conf`
PDFFILE=$1
PSFILE=$2

if [ "$PDFFILE" = "" -o "$PSFILE" = "" ]; then
	# Missing .pdf or .ps file
	exit 1
fi

case "$PARSER" in
	acrobat|acroread)
		if [ -x /usr/bin/acroread ]; then
			/usr/bin/acroread -toPostscript $PDFFILE $PSFILE
		fi
		;;

	xpdf|pdftotext)
		if [ -x /usr/bin/pdftotext ]; then
			/usr/bin/pdftotext $PDFFILE $PSFILE
		fi
		;;
esac

exit 0