pdftk and qpdf to reset PDF commenting security

user989762 picture user989762 · May 27, 2012 · Viewed 12.2k times · Source

to be able to add annotations to a pdf file in linux, i have to reset the "Commenting" security setting in the pdf document.

qpdf --decrypt input.pdf output.pdf should remove any passwords or "encryption" (according to this post)

pdftk input input.pdf output output.pdf allow AllFeatures should set all document securities (including "Commenting") to be allowed

After applying both commands, in acroread i can still see (file -> document -> security tab) that commenting is not allowed.

How can I reset this security property?

Answer

Kurt Pfeifle picture Kurt Pfeifle · May 27, 2012

The command qpdf --decrypt input.pdf output.pdf removes the 'owner' password. But it only works if there is no 'user' password set.

Once the owner password is removed, the output.pdf should already have unset all security protection and have allowed commenting. Needless to run your extra pdftk ... command then... BTW, your allow paramenter in your pdftk call will not work the way you quoted your command. The allow permissions will only be applied if you also...

  • ...either specify an encryption strength
  • ...or give a user or an owner password

Try the following to find out the detailed security settings of the file(s):

qpdf --show-encryption input.pdf
qpdf --show-encryption output.pdf