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
- pdftk -- this is the program we use
- original.pdf -- the, uh, original PDF file
- output -- tells pdftk to write the result to final.pdf
- final.pdf -- see above
- compress -- save some space at the expense of making the PDF code less readable
- flatten -- if there are any forms or other editable fields in the PDF, take that functionality out
- allow -- after this comes a list of words defining what users are allowed to do with the PDF besides view it
- printing -- this is what they are allowed to do
- owner_pw -- the next bit is the password of the PDF's owner
- lorumipsum -- the password
- 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.