I’m trying to convert from pdf pages to images, in order to use OCR on image.
I have Ubuntu 21.10
Python 3
import fitz
# read pdf file
pdf = fitz.open(file_path_name)
# load pdf page using index
page = pdf.loadPage(0)
The pdf is coming from scanner.
I tried to uninstall PyMuPDF, uninstall fitz and reinstall it again but still the error
sudo pip uninstall PyMuPDF
sudo pip uninstall fitz
sudo apt autoremove
sudo apt autoclean
reboot
sudo pip install PyMuPDF
answer
Collecting PyMuPDF
Using cached PyMuPDF-1.20.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.9 MB)
Installing collected packages: PyMuPDF
Successfully installed PyMuPDF-1.20.0
Any idea?
2
Answers
Try this code it may work it worked for me.I was having a similar problem.
The PyMUPDF library has changed naming conventions from camelCase to snake_cased. As a result, calls to
loadPage()
becomeload_page()
.More details of the name updates are found in the documentation for Deprecated Names.