Remove password from protected pdf file

So, my situation was that I wanted to check whether the credit card bill amount I was receiving was valid. I wanted to calculated for myself. The problem was that the pdf credit card statement being sent out by my bank was password and signature protected. It wouldnt allow copying text from it, which is rather weird. I have a genuine need to archive the pdf without password because after a couple of months, who’s going to remember what password it had, especially if you have a couple of different cards, each with its own password schema?

So the first step was to remove the password from it:
Install and run qpdf:

apt-get install qpdf
qpdf -decrypt --password=mypassword /mnt/c/temp/899XXXXXXXXXX32_11-02-2017.PDF /mnt/c/temp/1.pdf

This removes the password. The signature is still intact, but hooray, the pdf now allows copying text from it. I paste the text into my favorite text editor, and use a perl script to calculate for me.


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.