0

I am using module pdf2drive to convert my pdf file to image. But when I run, an error message poped up: "Unable to get page count. Is poppler installed and in PATH?"

I installed the poppler and I've added the path to Environment variables. In command prompt, it can run normally. message in command prompt

But afterwards, the same error message reported in IDE. error message in IDE

What should I do to solve this problem? Thanks!

This is my code:

import cv2
import pytesseract
from PIL import Image
import sys
from pdf2image import convert_from_path
import os

pdf_file = 'historical_data.pdf'
pages = convert_from_path(pdf_file,600)
image_path = 'pdf_image/'
image_counter = 1

for page in pages:

    filename = "page_"+str(image_counter)+".png"
    page.save(image_path+filename,600)
    image_counter +=1
林源煜
  • 26
  • 4
  • Please [don’t post images of code or error messages.](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-on-so-when-asking-a-question/285557#285557) – tripleee Jan 17 '22 at 05:36
  • 1
    Is the updated `PATH` available in your IDE? Did you restart it after configuring the system `PATH`? – tripleee Jan 17 '22 at 05:37
  • Sorry about posting image, I will not do it next time. I installed the latest version and it can recognize by IDE. But there is a new problem: "I/O Error: Couldn't open file 'historical_data.pdf': No error." I am not sure is this because this file is not ASCII-encoded – 林源煜 Jan 18 '22 at 01:49

0 Answers0