Does PDFTK respect PDF security flags?
I have a PDF File which says that document security is enabled. It says that the only things allowed are: Printing, Content Copying or Extraction, and Content Extraction for Accessibility.
I'm trying to use PDF Toolkit (PDFTK) to create a smaller version of this PDF file so that it takes up less hard drive space. When I try running PDFTK on the file, though, it says that the owner password is required. If I open up the file in a Adobe Reader, it doesn't ask for a password and opens up fine.
I'm not familiar with PDF encryption, and so I was wondering what's going on here and why I can read the file in Reader but not PDFTK.
It seems to me that there are three options:
- It's easy to read the data which is supposedly encrypted, but PDFTK respects the permissions flag and won't allow you to modify a file if you don't provide the owner's password.
- While it's possible to decrypt the data in a protected PDF (since it's not really secure), it's not a simple task and PDFTK didn't implement the logic needed to do this.
- The data is actually encrypted, and you need the owner password in order to read its contents.
Which of the three is correct?
It seems that #3 is unlikely since I am able to read the contents of the file in Acrobat without providing a password.
Your #1 is correct, and you can trivially fix pdftk: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=531529
Agree with James: It's #1. Most *NIX tools (except for Adobe Reader) don't respect "owner" permissions at all.
Do this to remove "owner" passwords (if no "user" password is set):
Install qpdf. If on Ubuntu/Debian, you can use sudo apt-get install qpdf
.
Once qpdf is installed use the following command:
qpdf --decrypt "filename.pdf" "output.pdf"
You can now do whatever you like with the file.