5

This follows up my previous question: How to check if PDF has been digitally signed?.

Just in doubt a document has been digitally signed (e.g. with Adobe), how to remove the signature?

In particular, does "print to file" remove it?

1 Answers1

3

If you've got ghostscript installed try:

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=%stdout% -c .setpdfwrite -f locked.pdf > unlocked.pdf

That would remove signature. If the pdf file has a password, then add parameter:

-sPDFPassword=$PASS

...and password would be disabled.

mzalazar
  • 141
  • Okay Ghostscript are quite cryptic for a newbie like, and the man page does not help. However the online doc helped me understanding that -c provides commands to execute and necessitates -f after in order to give input files. I need a way to check that the signature was effectively removed though... – PlasmaBinturong Jan 15 '21 at 17:30
  • The version of GhostScript (9.50) that comes with Ubuntu 20.04 complains that “The .setpdfwrite operator has been deprecated and will be removed entirely in the next release of Ghostscript.” Removing -c .setpdfwrite seems to work fine for me; out of interest, why did you include it in your command? – Wolfgang Oct 23 '21 at 22:05
  • 1
    @PlasmaBinturong You can check the output PDF with pdfsig unlocked.pdf (from the poppler-tools package). It will print “File 'unlocked.pdf' does not contain any signatures” if the PDF is unsigned. – Wolfgang Oct 23 '21 at 22:09
  • @Wolfgang this would be the answer to my linked question! Thanks! The package is poppler-utils for me. Does it work for Adobe signatures? – PlasmaBinturong Nov 09 '21 at 14:31