From: Don Armstrong Date: Thu, 9 Jun 2016 18:00:12 +0000 (-0500) Subject: add evince annot X-Git-Url: https://git.donarmstrong.com/?p=bin.git;a=commitdiff_plain;h=e88885b27f22602722e9087b31c073a64f0b06ca add 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"