Created
October 23, 2024 19:01
-
-
Save megahall/978fb47bda2ac2a6a541558578442702 to your computer and use it in GitHub Desktop.
Watermark Your PDF With A Specific String In Linux
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 | |
watermark="${1}" | |
shift | |
wm_pdf="$(mktemp -t watermark_XXXXXX.pdf)" | |
convert -background none -fill "rgba(128, 128, 128, 0.7)" -gravity center -font Arial -pointsize 96 "label:${watermark}" -bordercolor none -border 10x10 "${wm_pdf}" | |
for input in "$@"; do | |
output="$(basename "${input}" .pdf)_wm.pdf" | |
qpdf --overlay "${wm_pdf}" --repeat=1 -- "${input}" "${output}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment