Skip to content

Instantly share code, notes, and snippets.

@moisespsena
Created August 21, 2014 03:32
Show Gist options
  • Save moisespsena/745cefd9ddb9fec6ee47 to your computer and use it in GitHub Desktop.
Save moisespsena/745cefd9ddb9fec6ee47 to your computer and use it in GitHub Desktop.
Unlock PDF file with ghostscript
#!/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