Powerpoint docs: add option to have rclppt use unoconv

This commit is contained in:
Jean-Francois Dockes 2013-11-12 09:56:50 +01:00
parent a1f58fa057
commit a9358d2f03

View File

@ -30,6 +30,7 @@ LC_ALL=C ; export LC_ALL
progname="rclppt" progname="rclppt"
filetype=powerpoint filetype=powerpoint
RCLPPT_CATPPT=${RCLPPT_CATPPT:=yes}
#RECFILTCOMMONCODE #RECFILTCOMMONCODE
############################################################################## ##############################################################################
@ -97,20 +98,54 @@ umask 77
# !! Leave the following line unmodified ! # !! Leave the following line unmodified !
#ENDRECFILTCOMMONCODE #ENDRECFILTCOMMONCODE
checkcmds catppt if test X$RCLPPT_CATPPT = Xyes ; then
checkcmds catppt
# output the result # output the result
echo '<html><head>' echo '<html><head>'
#echo '<title>' "$title" '</title>' #echo '<title>' "$title" '</title>'
echo '<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">' echo '<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">'
echo '</head><body>' echo '</head><body>'
echo '<pre>' echo '<pre>'
catppt -d utf-8 "$infile" | \ catppt -d utf-8 "$infile" | \
sed -e 's/</&lt;/g' -e 's/&/&amp;/g' sed -e 's/</&lt;/g' -e 's/&/&amp;/g'
echo '</pre>' echo '</pre>'
echo '</body></html>' echo '</body></html>'
# exit normally # exit normally
exit 0 exit 0
else
# Using unoconv
checkcmds unoconv pdftotext
# This needs a temp dir because we first output pdf (outputting html
# would produce one file per page), and pdftotext can't read from
# stdin
if test z"$RECOLL_TMPDIR" != z; then
ttdir=$RECOLL_TMPDIR
elif test z"$TMPDIR" != z ; then
ttdir=$TMPDIR
else
ttdir=/tmp
fi
tmpdir=$ttdir/rclppt_tmp$$
mkdir $tmpdir || exit 1
mkdir $tmpdir/rclppttmp || exit 1
unopdf=$tmpdir/rclppttmp/output.pdf
cleanup()
{
# Note that we're using a constant part (rclkwdtmp), that hopefully
# guarantees that we can't do big mistakes here.
rm -rf $tmpdir/rclppttmp
rmdir $tmpdir
}
trap cleanup EXIT HUP QUIT INT TERM
unoconv -f pdf -o $unopdf "$infile"
`dirname $0`/rclpdf $unopdf
fi