Copy protect a PDF using pdftk

Say you want to reduce the size of a PDF, flatten it and make it harder to extract the text from.

$ pdftk original.pdf output final.pdf compress flatten allow printing owner_pw lorumipsum encrypt_128bit

Huh?

  1. pdftk -- this is the program we use
  2. original.pdf -- the, uh, original PDF file
  3. output -- tells pdftk to write the result to final.pdf
  4. final.pdf -- see above
  5. compress -- save some space at the expense of making the PDF code less readable
  6. flatten -- if there are any forms or other editable fields in the PDF, take that functionality out
  7. allow -- after this comes a list of words defining what users are allowed to do with the PDF besides view it
  8. printing -- this is what they are allowed to do
  9. owner_pw -- the next bit is the password of the PDF's owner
  10. lorumipsum -- the password
  11. encrypt_128bit -- specify the encryption strength

Some flags depend on others -- for example, if you don't use owner_pw then you don't need a password or an encryption strength. Similarly, you cannot only allow certain operations to users without defining them as not the owner, or without encrypting it, so the allow section makes not sense without those other flags.

Wherever you go, there you are.

 

Home