Skip to content

Instantly share code, notes, and snippets.

@niw
Created January 13, 2022 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niw/203719671946a74cc23dbfe33836b6d2 to your computer and use it in GitHub Desktop.
Save niw/203719671946a74cc23dbfe33836b6d2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Download ghostpdl source code from <https://github.com/ArtifexSoftware/ghostpdl-downloads/releases>,
# expand an archive, and configure then make.
# Following `BIN_PATH` may need to change for the given version and path.
set -euo pipefail
readonly CURRENT_PATH=$(cd "$(dirname "$BASH_SOURCE[0]")" >/dev/null; pwd)
readonly BIN_PATH=$CURRENT_PATH/ghostpdl-9.55.0/bin
if (( $# < 1 )); then
echo "Usage: $0 xpsfile"
exit 1
fi
readonly INPUT_FILE="$1"
readonly OUTPUT_FILE="${1%.xps}.pdf"
exec $BIN_PATH/gxps \
-sDEVICE=pdfwrite \
-sOutputFile="$OUTPUT_FILE" \
-dNOPAUSE \
"$INPUT_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment