pdf2image: PDF to TIFF conversion returns a file not found error

This issue is working with the same pdf and program that oschwartz10612 opened a few days ago.
As they said, we were able to get the program to produce images rather than white squares. However, this only works with certain types of image files. I’ve been using PNG as the output format, however there is always a noticeable level of compression in the final pdf (the program converts the pdf to images for editing, then converts the images back into a pdf).
When I use TIFF, ultimately the format I’d like to use, the following error is returned.

C:\Users\eleph>C:/Python/Python38/python.exe "c:/Users/eleph/Documents/My Documents/CROTEK/Workspace/Algorithm for Correcting Scanned Documents/main_and_ocr.py" Traceback (most recent call last): File "c:/Users/eleph/Documents/My Documents/CROTEK/Workspace/Algorithm for Correcting Scanned Documents/main_and_ocr.py", line 82, in <module> convert_from_path( File "C:\Python\Python38\lib\site-packages\pdf2image\pdf2image.py", line 108, in convert_from_path poppler_version = _get_poppler_version( File "C:\Python\Python38\lib\site-packages\pdf2image\pdf2image.py", line 394, in _get_poppler_version proc = Popen(command, env=env, stdout=PIPE, stderr=PIPE) File "C:\Python\Python38\lib\subprocess.py", line 854, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Python\Python38\lib\subprocess.py", line 1307, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] The system cannot find the file specified

Here is the part of the code that converts the pdf to images.

convert_from_path( pdf_path = (subfolder + "/" + "no_text_" + filename), output_folder = subfolder, fmt = "tiff", output_file = (f"no_text_{filename}") )

Lastly, here is the pdf: https://github.com/Belval/pdf2image/files/4707847/oneword.pdf

I’m using Windows 10. I’m relatively new to coding, so if there’s any important information I’ve accidentally excluded please let me know. Any help you could provide would be greatly appreciated.

Edit: I just realized the error I pasted is really difficult to read, but I’m unsure of how to format it well while keeping it in the code format. My sincerest apologies.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

This was fixed in conda-forge/poppler-feedstock#67. You can download using conda or the packaged version here: https://github.com/oschwartz10612/poppler-windows