From a9358d2f0336b68f9eb7a32451dbd2341d83da25 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Tue, 12 Nov 2013 09:56:50 +0100 Subject: [PATCH] Powerpoint docs: add option to have rclppt use unoconv --- src/filters/rclppt | 61 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/src/filters/rclppt b/src/filters/rclppt index b3891d83..fb0fa4da 100755 --- a/src/filters/rclppt +++ b/src/filters/rclppt @@ -30,6 +30,7 @@ LC_ALL=C ; export LC_ALL progname="rclppt" filetype=powerpoint +RCLPPT_CATPPT=${RCLPPT_CATPPT:=yes} #RECFILTCOMMONCODE ############################################################################## @@ -97,20 +98,54 @@ umask 77 # !! Leave the following line unmodified ! #ENDRECFILTCOMMONCODE -checkcmds catppt +if test X$RCLPPT_CATPPT = Xyes ; then + checkcmds catppt -# output the result -echo '' -#echo '' "$title" '' -echo '' -echo '' -echo '
'
+  # output the result
+  echo ''
+  #echo '' "$title" ''
+  echo ''
+  echo ''
+  echo '
'
 
-catppt -d utf-8 "$infile" | \
-   sed -e 's/'
-echo ''
+  echo '
' + echo '' -# exit normally -exit 0 + # exit normally + 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