| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# Wrapper script for the ht://Dig PDF parser engine |
| 4 |
# |
| 5 |
# This script is called by the htdig binary to parse pdf documents |
| 6 |
# Set the debian_pdf_parsed in the htdig configuration |
| 7 |
# |
| 8 |
# |
| 9 |
# Written by Stijn de Bekker <[email protected]> for Debian GNU/Linux. |
| 10 |
|
| 11 |
|
| 12 |
#PARSER=`grep debian_pdf_parser /etc/htdig/htdig.conf | awk '{ print $2 }' |
| 13 |
# replaced with the following line, suggestion by pod, should fix #196916 |
| 14 |
PARSER=`awk '/^debian_pdf_parser:/{ print $2 }' /etc/htdig/htdig.conf` |
| 15 |
PDFFILE=$1 |
| 16 |
PSFILE=$2 |
| 17 |
|
| 18 |
if [ "$PDFFILE" = "" -o "$PSFILE" = "" ]; then |
| 19 |
# Missing .pdf or .ps file |
| 20 |
exit 1 |
| 21 |
fi |
| 22 |
|
| 23 |
case "$PARSER" in |
| 24 |
acrobat|acroread) |
| 25 |
if [ -x /usr/bin/acroread ]; then |
| 26 |
/usr/bin/acroread -toPostscript $PDFFILE $PSFILE |
| 27 |
fi |
| 28 |
;; |
| 29 |
|
| 30 |
xpdf|pdftotext) |
| 31 |
if [ -x /usr/bin/pdftotext ]; then |
| 32 |
/usr/bin/pdftotext $PDFFILE $PSFILE |
| 33 |
fi |
| 34 |
;; |
| 35 |
esac |
| 36 |
|
| 37 |
exit 0 |