error: Unable to find trailer dictionary while recovering damaged file

3.4k views Asked by At

PyPDF2 fail sometimes with decryption of some PDF files, and I am trying do decrypt them with pikepdf but I am getting this error: Unable to find trailer dictionary while recovering damaged file Any ideas?

1

There are 1 answers

0
Martin Thoma On

You can fix broken PDF document with mutool from MuPDF:

mutool clean -d input.pdf output.pdf

However, the file might just be broken beyond recovery.