Created
July 8, 2020 08:37
-
-
Save WPettersson/325a9e72edf5e9fbe3c6bbe3a699472f to your computer and use it in GitHub Desktop.
Takes a Xournalpp xopp file, finds the embedded PDF location, copies the embedded pdf to `pwd`, and updates the xopp file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
XOPP_RAW=$(mktemp) | |
gunzip -c "$1" > ${XOPP_RAW} | |
PDF_LOC=$(awk -F\" '/domain="absolute" filename/ {print $6}' ${XOPP_RAW}) | |
cp ${PDF_LOC} . | |
NEW_LOC="$(pwd)/$(basename ${PDF_LOC})" | |
echo ${NEW_LOC} | |
sed "s!${PDF_LOC}!${NEW_LOC}!" -i ${XOPP_RAW} | |
gzip -c ${XOPP_RAW} > "$1" | |
rm ${XOPP_RAW} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment