Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/odftops-filter
diff options
context:
space:
mode:
authorVamsi Krishna Davuluri <vamsi@linux-qrtc.site>2009-05-19 06:25:20 (GMT)
committer Vamsi Krishna Davuluri <vamsi@linux-qrtc.site>2009-05-19 06:25:20 (GMT)
commit848fca43e2175b74f8fcbf5de9a8fec739b41355 (patch)
tree31c050caa31b247c3807dafe8bf28bf3e975a0cb /odftops-filter
parent83338521e86f15f88c57f29d9d81f0d9ee6a76f5 (diff)
added odftops final filter
Diffstat (limited to 'odftops-filter')
-rw-r--r--odftops-filter/odftops67
-rw-r--r--odftops-filter/odftops267
2 files changed, 134 insertions, 0 deletions
diff --git a/odftops-filter/odftops b/odftops-filter/odftops
new file mode 100644
index 0000000..d142bf8
--- /dev/null
+++ b/odftops-filter/odftops
@@ -0,0 +1,67 @@
+#!/bin/bash
+# CUPS filter to process ODT files using abiword
+
+
+
+# $6 happens to be the path to file passed as argument
+
+fn="$6"
+
+#for our subshell convenience
+
+sandbox1="${TMPDIR1:-/tmp}/tempcups.$$"
+(umask 077 && mkdir "$sandbox1") || exit 1
+
+
+# we are creating a dummy folder, which can take different file types.
+
+sandbox="${TMPDIR:-/tmp}/cups-odftops.$$"
+(umask 077 && mkdir "$sandbox") || exit 1
+
+
+#The condition which checks whether our abiword is 2.6.6+ or 2.6.6-
+
+$(abiword --to="$sandbox1/temp123.doc" "$fn")
+
+if [ "$?" -ne 0 ];
+
+then
+
+#our dummy file
+
+fn1="$sandbox/temp123.odt"
+
+cp "$fn" "$fn1"
+
+# Call abiword quietly, securely
+
+abiword --to="ps" "$fn1"
+
+fn2="`echo "$fn1" | sed -e 's/odt$/ps/' `"
+
+else
+
+#check if our version doesn't require an intermediate conversion,
+#if it does, do it
+
+$(abiword --to="$sandbox1/temp123.ps" "$fn")
+
+if [ "$?" -ne 0 ];
+
+then
+
+abiword --to="$sandbox/temp123.ps" "$sandbox1/temp123.doc"
+
+else
+
+abiword --to="$sandbox/temp123.ps" "$fn"
+fn2="$sandbox/temp123.ps"
+fi
+
+fi
+
+cat "$fn2"
+
+#remove the sandbox folder, for debugging purposes check by commenting the following line and see what is in the /tmp/ folder
+rm -rf $sandbox
+rm -rf $sandbox1
diff --git a/odftops-filter/odftops2 b/odftops-filter/odftops2
new file mode 100644
index 0000000..d142bf8
--- /dev/null
+++ b/odftops-filter/odftops2
@@ -0,0 +1,67 @@
+#!/bin/bash
+# CUPS filter to process ODT files using abiword
+
+
+
+# $6 happens to be the path to file passed as argument
+
+fn="$6"
+
+#for our subshell convenience
+
+sandbox1="${TMPDIR1:-/tmp}/tempcups.$$"
+(umask 077 && mkdir "$sandbox1") || exit 1
+
+
+# we are creating a dummy folder, which can take different file types.
+
+sandbox="${TMPDIR:-/tmp}/cups-odftops.$$"
+(umask 077 && mkdir "$sandbox") || exit 1
+
+
+#The condition which checks whether our abiword is 2.6.6+ or 2.6.6-
+
+$(abiword --to="$sandbox1/temp123.doc" "$fn")
+
+if [ "$?" -ne 0 ];
+
+then
+
+#our dummy file
+
+fn1="$sandbox/temp123.odt"
+
+cp "$fn" "$fn1"
+
+# Call abiword quietly, securely
+
+abiword --to="ps" "$fn1"
+
+fn2="`echo "$fn1" | sed -e 's/odt$/ps/' `"
+
+else
+
+#check if our version doesn't require an intermediate conversion,
+#if it does, do it
+
+$(abiword --to="$sandbox1/temp123.ps" "$fn")
+
+if [ "$?" -ne 0 ];
+
+then
+
+abiword --to="$sandbox/temp123.ps" "$sandbox1/temp123.doc"
+
+else
+
+abiword --to="$sandbox/temp123.ps" "$fn"
+fn2="$sandbox/temp123.ps"
+fi
+
+fi
+
+cat "$fn2"
+
+#remove the sandbox folder, for debugging purposes check by commenting the following line and see what is in the /tmp/ folder
+rm -rf $sandbox
+rm -rf $sandbox1