Created
February 17, 2026 10:33
-
-
Save fwdekker/0eedc32483bc490ab3b7a1903fe02173 to your computer and use it in GitHub Desktop.
Rasterise PDF and annotations
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
| #!/bin/sh | |
| # Config | |
| IN_FILE="my_file.pdf" | |
| # Script | |
| BASENAME="$(printf "%s" "$IN_FILE" | cut -d. -f1)" | |
| EXTENSION="$(printf "%s" "$IN_FILE" | cut -d. -f2)" | |
| OUT_FILE="$BASENAME.rasterised.$EXTENSION" | |
| TMP_FILE="$(mktemp)" | |
| convert -render -density 300 "$IN_FILE" "$TMP_FILE" | |
| gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile="$OUT_FILE" "$TMP_FILE" | |
| rm -f "$TMP_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment