]> git.donarmstrong.com Git - bin.git/commitdiff
add evince annot
authorDon Armstrong <don@donarmstrong.com>
Thu, 9 Jun 2016 18:00:12 +0000 (13:00 -0500)
committerDon Armstrong <don@donarmstrong.com>
Thu, 9 Jun 2016 18:00:12 +0000 (13:00 -0500)
evince_annot [new file with mode: 0755]

diff --git a/evince_annot b/evince_annot
new file mode 100755 (executable)
index 0000000..1a9c1e3
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+
+set -x 
+TMPDIR="$(mktemp -d)"
+
+mkdir -p "$TMPDIR/a"
+mkdir -p "$TMPDIR/b"
+cp -l "$1" "$TMPDIR/a/file.pdf";
+if [ -e "${1}.annot" ]; then
+    cp "$1" "$TMPDIR/b/file.pdf";
+    chmod u+w "$TMPDIR/b/file.pdf"
+    qprint -d "${1}.annot" | patch -d "$TMPDIR/b" --binary;
+else
+    chmod u+w "$TMPDIR/b/file.pdf"
+    cp "$1" "$TMPDIR/b/file.pdf";
+fi;
+
+
+(cd "$TMPDIR/b"
+ chmod u+w "file.pdf"
+ ## evince really should just use the same document-directory
+ gsettings set org.gnome.Evince document-directory "'file://$TMPDIR/b'";
+ evince "file.pdf"
+);
+
+(cd "$TMPDIR";
+ diff -Nura a b ) | qprint -e > "${1}.annot"
+rm -f "$TMPDIR/a/file.pdf"
+rm -f "$TMPDIR/b/file.pdf"
+rmdir "$TMPDIR/a" "$TMPDIR/b" "$TMPDIR"