Skip to content

Fix page count on some PDF files, and fix a Python 3 incompatibility

O2 Graphics requested to merge O2Graphics/mayan-edms:fix-PDF-page-count into master

The page count was working on most of my PDF files, but I got a "EOF marker not found" error on one of them. This error is well known in PyPDF2, but this library isn't maintained anymore: https://github.com/mstamy2/PyPDF2/issues/177

So, I've used pdfinfo to count pages in case we encounter this error. While here, the code to call pdfinfo was already present, so I moved it in a function. I also had to call list(filter(...)), because just filter(...) wasn't working in Python 3 ( https://diveintopython3.problemsolving.io/porting-code-to-python-3-with-2to3.html#filter )

Merge request reports