Skip to content

Instantly share code, notes, and snippets.

@davidfoerster
Last active January 1, 2018 12:08
Show Gist options
  • Save davidfoerster/9c11bc43f896b7cbd6f9f3fc6f7d79a3 to your computer and use it in GitHub Desktop.
Save davidfoerster/9c11bc43f896b7cbd6f9f3fc6f7d79a3 to your computer and use it in GitHub Desktop.
Decrypt PDF to PS
#!/bin/sh
INPUT=doc.pdf
OUTPUT=doc.ps
PASSWORD=foobar
gs -sDEVICE=pswrite -dSAFER -dBATCH -dNOPAUSE \
-dColorConversionStrategy=/LeaveColorUnchanged -dDownsampleMonoImages=false -dDownsampleGrayImages=false \
-dDownsampleColorImages=false -dAutoFilterColorImages=false -dAutoFilterGrayImages=false \
-dColorImageFilter=/FlateEncode -dGrayImageFilter=/FlateEncode -dPassThroughJPEGImages=true \
-sPDFPassword="$PASSWORD" -sOutputFile="$OUTPUT" "$INPUT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment