Cannot decrypt PDF missing 'ID' in trailer #608
Labels
is-bug
From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF
is-robustness-issue
From a users perspective, this is about robustness
workflow-encryption
From a users perspective, encryption is the affected feature/workflow
Bug report
Some PDFs (e.g. encrypted_doc_no_id.pdf) are encrypted but do not contain an 'ID' value in their trailer, causing decryption to fail. This also affects pdfminer.six where I've opend this issue.
Steps to reproduce
raises a
KeyError: '/ID'
.Solution
As Apache PDFBox does, if no 'ID' is specified in the trailer then supply an array with two empty byte strings in its place.
produces
and succesfully decrypts the PDF.
Next steps
If this project is still actively maintained I can open a PR. Otherwise I leave this issue here for other users that may encounter the same
KeyError: '/ID'
and wonder how to fix it.The text was updated successfully, but these errors were encountered: