Created
March 22, 2021 21:59
-
-
Save azettl/8546b17bd4880ce44c9b5b2b2ca596a9 to your computer and use it in GitHub Desktop.
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 | |
# create temp files for html and pdf output | |
tin=$(tempfile) || exit | |
tout=$(tempfile) || exit | |
trap "rm -f -- '$tin'" EXIT | |
trap "rm -f -- '$tout'" EXIT | |
# write stdin to input temp file | |
echo "$(</dev/stdin)" > "$tin" | |
# execute pdfreactor in silent mode and write potential output to stderr | |
java -jar pdfreactor.jar -q -i "$tin" -o "$tout" 1>&2 | |
# write pdf content to stdout | |
cat "$tout" | |
# remove temp files | |
rm -f -- "$tin" | |
rm -f -- "$tout" | |
trap - EXIT | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment