I am trying to open a word/pdf file that is locked with a password using python, without using a library like python-docx
or PDFMiner
or such.
I was wondering if anyone knows a way in which you can supply the password to the file so you will be able to read it's content. This is kind of similar to the option of entering a user name and password for a web form.
According to this webpage the password is just a setting in the settings.xml
file in the (zipped) docx
file. It does not seem to encrypt the actual contents of the file, because you can delete settings.xml
, save the document and still open it...
So you should just be able to read the contents.
Note that this doesn't work with office 2013, where password "protection" seems to have been retired in favor of encryption.