skip to Main Content

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


  1. import fitz
    # read pdf file
    pdf = fitz.open(file_path_name)
    # load pdf page using index
    page = pdf.load_page(0)
    

    Try this code it may work it worked for me.I was having a similar problem.

    Login or Signup to reply.
  2. The PyMUPDF library has changed naming conventions from camelCase to snake_cased. As a result, calls to loadPage() become load_page().

    More details of the name updates are found in the documentation for Deprecated Names.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search