Created
June 23, 2021 07:32
-
-
Save anamorph/05899bee05ee4a855efe8b00b14018db to your computer and use it in GitHub Desktop.
Creates an alias to compress (quick & dirty) pdfs via the terminal
This file contains hidden or 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
# pre-reqs: | |
# ghostscript -> brew install ghostscript | |
function compresspdf { | |
INPUT_FILE=$1 | |
FILE_EXTENSION="${INPUT_FILE##*.}" | |
FILE_NAME="${INPUT_FILE%.*}" | |
OUTPUT_FILE="$FILE_NAME-compressed.$FILE_EXTENSION" | |
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dColorImageResolution=150 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=$OUTPUT_FILE $INPUT_FILE | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment