I am using qpdf to decrpyt pdf files (encrytpted but without password) as pypdf2 decryption doesn't work.
It is working on command line but with python giving
FileNotFoundError
qpdf --decrypt --replace-input test.pdf # it's working; replacing test.pdf with the absolute path
But with python it doesn't
inp_file = open(self.path, "rb")
inp_pdf = PdfFileReader(inp_file)
if inp_pdf.isEncrypted:
try:
inp_pdf.decrypt('')
except:
subprocess.run(["qpdf", "--decrypt", "--replace-input", self.path)])