Removing encryption from (legitimate!) PDF files on Ubuntu

Many service providers have started encrypting the statements that they send you. While at some level, it does add some amount of security when the path to your inbox is not very secure. However, it is sometimes a major pain when you want to archive your emails. This is because every provider has decided on a different secret to encrypt your PDF. So if one day you wish to access a statement of your phone bill from three months back, you have to look up the bill from your archive and read the mail to find out what they used to encrypt it. With my credit card statements, phone bills etc coming in as encrypted PDFs, archiving them all becomes a major pain.

So I decided to only archive un-encrypted PDF statements from now on. I consider this as a very legitimate reason to bypass PDF encryption and do not see any legal (or at least moral) reason for doing so. So you corporate lawyers looking for a DMCA victim, get out of my face.

For years, I have been using pdftk on my Ubuntu systems to manipulate PDFs. However, it being written in Java, installing it pulls in, among other things, the gcj runtime, etc. It was a minor irritation all this while. However, things finally came to a head when it refused to decrypt my credit card statement. PDFs have the concept of an owner password and an user password. The person who creates the PDF can set either one or both. Apparently, the ICICI credit card statements come with an owner password apart from an user password., and pdftk refused to decrypt the pdf without the owner password while all I had was the user password.

I searched around the net, and discovered another pdf manipulation gem, lying in the Ubuntu repositories no less, which can do what I want: QPDF.

So here is how I went around decrypting my statement.

$ sudo apt-get install qpdf $ qpdf --decrypt --password=mypassword input.pdf output.pdf $ evince output.pdf # to check if it asks for password

That is it!

Share Comments
comments powered by Disqus