ppt filter: support unoconv 0.4 by using directory as parameter to -o

This commit is contained in:
Jean-Francois Dockes 2013-11-14 19:09:47 +01:00
parent f092ad0a49
commit f8e23f5a90

View file

@ -121,20 +121,23 @@ fi
tmpdir=$ttdir/rclppt_tmp$$ tmpdir=$ttdir/rclppt_tmp$$
mkdir $tmpdir || exit 1 mkdir $tmpdir || exit 1
mkdir $tmpdir/rclppttmp || exit 1 mkdir $tmpdir/rclppttmp || exit 1
unopdf=$tmpdir/rclppttmp/output.pdf
# We have to use a directory as output parameter to unoconv. Up to
# version 0.5, it could not use a file name for this
unopdf=$tmpdir/rclppttmp
cattxt=$tmpdir/rclppttmp/output.txt cattxt=$tmpdir/rclppttmp/output.txt
cleanup() cleanup()
{ {
# Note that we're using a constant part (rclkwdtmp), that hopefully # Note that we're using a constant part (rclppttmp), which
# guarantees that we can't do big mistakes here. # hopefully guarantees that we can't do big mistakes here.
rm -rf $tmpdir/rclppttmp rm -rf $tmpdir/rclppttmp
rmdir $tmpdir rmdir $tmpdir
} }
trap cleanup EXIT HUP QUIT INT TERM trap cleanup EXIT HUP QUIT INT TERM
# Try catppt. If the output looks too small and unoconv is available, use this # Try catppt. If the output looks too small and unoconv is available,
# instead. unoconv is very slow but it handles newer files that catppt will # use this instead. unoconv is very slow but it handles newer files
# not convert. # that catppt will not convert.
# #
# I'm not sure of the right test for detecting catppt failure. On the # I'm not sure of the right test for detecting catppt failure. On the
# sample I have, it outputs Azure\n1_Azure\n\n. I don't know if Azure # sample I have, it outputs Azure\n1_Azure\n\n. I don't know if Azure
@ -145,8 +148,8 @@ catppt -d utf-8 "$infile" > $cattxt
lines=`wc -l < $cattxt` lines=`wc -l < $cattxt`
if test $lines -lt 5 -a X$haveunoconv = Xyes; then if test $lines -lt 5 -a X$haveunoconv = Xyes; then
unoconv -f pdf -o $unopdf "$infile" unoconv -f pdf -o "$unopdf" "$infile"
`dirname $0`/rclpdf $unopdf `dirname $0`/rclpdf "$unopdf/${infile%.*}.pdf"
else else
# output the catppt result # output the catppt result
echo '<html><head>' echo '<html><head>'