Last active
June 20, 2022 02:19
-
-
Save kevcjones-archived/4483127 to your computer and use it in GitHub Desktop.
Unlocking a PDF using 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
required - install ghost script - e.g brew install ghostscript (takes a few minutes) | |
update this line as needed and run in terminal | |
-- New and updated thanks to comments -- | |
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -SPDFPassword=THE_PASSWORD -sOutputFile=unencrypted.pdf -c .setpdfwrite -f 2017-06-13-11-55-56-188_14972345156188_XXXPT6345X_ITRV.pdf | |
-- Original -- | |
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f encrypted.pdf |
@denysvega Thank you so much for your comment. It's the only one that works
Exactly what @mustaqimM said. Thanks, @denysvega! Worked for me too.
I've updated the original gist now - cheers @denysvega
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi... I know this discussion has more than 2 years...
@gkArvindr you must provide the PDF password using the -SPDFPassword parameter.
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -SPDFPassword=THE_PASSWORD -sOutputFile=unencrypted.pdf -c .setpdfwrite -f 2017-06-13-11-55-56-188_14972345156188_XXXPT6345X_ITRV.pdf