Created
August 21, 2014 03:32
-
-
Save moisespsena/745cefd9ddb9fec6ee47 to your computer and use it in GitHub Desktop.
Unlock PDF file with ghostscript
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 | |
# usage: pdf-unlock.sh locked.pdf > unlocked | |
# more info: http://superuser.com/questions/367184/pdf-removing-usage-restrictions | |
which ghostscript >/dev/null || { | |
echo "ERROR: install 'ghostscript' package using 'sudo apt-get install ghostscript' command >&2" | |
} | |
gs -sPDFPassword=$PASS -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=%stdout% -c .setpdfwrite -f "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment