From e88885b27f22602722e9087b31c073a64f0b06ca Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Thu, 9 Jun 2016 13:00:12 -0500 Subject: [PATCH] add evince annot --- evince_annot | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 evince_annot diff --git a/evince_annot b/evince_annot new file mode 100755 index 0000000..1a9c1e3 --- /dev/null +++ b/evince_annot @@ -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" -- 2.39.2