Replies: 7 comments 6 replies
-
me too, it seems fitz already update this function to page_count . But I don't know how to fix it. |
Beta Was this translation helpful? Give feedback.
-
try another version of PyMuPDF (<1.21.0) |
Beta Was this translation helpful? Give feedback.
-
I tried pymupdf==1.19.0,and it required 1.20.0. I installed pymupdf==1.20.0 and 1.21.0. AttributeError: 'Document' object has no attribute 'pageCount'. There is no way to deal with pdf files. |
Beta Was this translation helpful? Give feedback.
-
One solution which seems to work: Edit directly ppocr/utils/utility.py From line 93-> for pg in range(0, pdf.page_count):
page = pdf[pg]
mat = fitz.Matrix(2, 2)
pm = page.get_pixmap(matrix=mat, alpha=False)
# if width or height > 2000 pixels, don't enlarge the image
if pm.width > 2000 or pm.height > 2000:
pm = page.get_pixmap(matrix=fitz.Matrix(1, 1), alpha=False) So change camelCases to snake_case:
|
Beta Was this translation helpful? Give feedback.
-
Please also update the documentation https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.7/doc/doc_en/quickstart_en.md |
Beta Was this translation helpful? Give feedback.
-
pdfDoc = fitz.open(pdfPath) |
Beta Was this translation helpful? Give feedback.
-
I found out the bug is just present in the documentation. The libraries have updated it. In the code just replace pageCount to page_count and getPixmap to get_pixmap |
Beta Was this translation helpful? Give feedback.
-
While executing the PDF code, I got the following error:
AttributeError: 'Document' object has no attribute 'pageCount'
Beta Was this translation helpful? Give feedback.
All reactions