#!/bin/sh

# Setting PATH
PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export PATH

# save stdin to a file since pdftohtml doesn't work on streams
TEMP=`mktemp`
dd of=$TEMP 2> /dev/null
pdftohtml -stdout -i -noframes -nodrm -hidden "$TEMP" | html2text -nobs - - | sed '/^[\=]\+/ d' |sed '$d' | sed '1d' | sed '/^$/d'  # trim first, last and blank lines
rm $TEMP
