Giter Club home page Giter Club logo

Comments (11)

gauravv7 avatar gauravv7 commented on July 29, 2024 21

confirming, this issue also occurs for ubuntu 14.04 LTS x64.
solution: sudo apt-get install -y poppler-utils
but somehow installation didn't worked for the first time. second install over the first without any uninstallation solves for me.

from pdf2image.

Belval avatar Belval commented on July 29, 2024

pdfinfo is part of the poppler-utils package. It is used to count how many pages there are in the PDF before processing.

Ultimately, this information is needed mostly for multiprocessing and limiting the number of pages processed.

I can assist you in installing pdfinfo but I would need your OS first.

from pdf2image.

DJDrennan avatar DJDrennan commented on July 29, 2024

I installed poppler, but I'm still getting an error... what do I try next ?

In [1]: from pdf2image import *

In [2]: images = convert_from_path('/home/dianad/testing/UDC-000280.pdf', output_folder='/home/dianad/testing', first_page=1,
...: last_page=1, fmt='jpg')

AttributeError Traceback (most recent call last)
~/.conda/envs/dc/lib/python3.5/site-packages/pdf2image/pdf2image.py in __page_count(pdf_path, userpw)
162 # This will throw if we are unable to get page count
--> 163 return int(re.search(r'Pages:\s+(\d+)', out.decode("utf8", "ignore")).group(1))
164 except:

AttributeError: 'NoneType' object has no attribute 'group'

During handling of the above exception, another exception occurred:

Exception Traceback (most recent call last)
in ()
----> 1 images = convert_from_path('/home/dianad/testing/UDC-000280.pdf', output_folder='/home/dianad/testing', first_page=1, last_page=1, fmt='jpg')

~/.conda/envs/dc/lib/python3.5/site-packages/pdf2image/pdf2image.py in convert_from_path(pdf_path, dpi, output_folder, first_page, last_page, fmt, thread_count, userpw)
27 """
28
---> 29 page_count = __page_count(pdf_path, userpw)
30
31 if thread_count < 1:

~/.conda/envs/dc/lib/python3.5/site-packages/pdf2image/pdf2image.py in __page_count(pdf_path, userpw)
163 return int(re.search(r'Pages:\s+(\d+)', out.decode("utf8", "ignore")).group(1))
164 except:
--> 165 raise Exception('Unable to get page count.')
166
167 def __load_from_output_folder(output_folder, uid):

Exception: Unable to get page count.

In [3]:

from pdf2image.

Belval avatar Belval commented on July 29, 2024

If you installed poppler the error is somewhere else. First check that you can call pdfinfo on your pdf.

pdfinfo /home/dianad/testing/UDC-000280.pdf

Also, if you could provide me with a sample so I can reproduce the issue on my side it would be helpful.

Make a minimal test case with a freshly cloned version of the project too. I added the stderr to the Exception message so it might be more relevant.

from pdf2image.

zevgriner avatar zevgriner commented on July 29, 2024

A friend has the same problem.
When the package is initialized, for Windows, at least, please check the "path" to make sure poppler exists in the path. Otherwise, the package generates a FileNotFound error when pdfinfo can't be found, without specifying which file can't be found.
OR, if the poppler installation procedure doesn't reliably set the path, add a method that lets the user specify the path.

from pdf2image.

Belval avatar Belval commented on July 29, 2024

@zevgriner do you consider this an acceptable solution: a31453f?

I don't want to check for pdfinfo/pdftoppm existence in PATH because that would add an overhead for everyone who configured their installation correctly.

As for adding a parameter, this is mostly a problem for Windows users with a bad configuration, it wouldn't make much sense to add it. Instead, I believe we should encourage people in the "good" direction of setting up poppler properly.

Please share your thoughts on the matter.

from pdf2image.

Belval avatar Belval commented on July 29, 2024

Hmmm, I must confess I always used it with Ubuntu 16.04 and up. I'll check the doc and possibly update the README so people don't get confused.

from pdf2image.

Belval avatar Belval commented on July 29, 2024

Added Ubuntu 16.04+ mention in 2f8b627

from pdf2image.

guanshuicheng avatar guanshuicheng commented on July 29, 2024

confirming, this issue also occurs for ubuntu 14.04 LTS x64.
solution: sudo apt-get install -y poppler-utils
but somehow installation didn't worked for the first time. second install over the first without any uninstallation solves for me.

Thank you very much,it works for me

from pdf2image.

nemadaliev avatar nemadaliev commented on July 29, 2024

Thank you, did work for me too.

from pdf2image.

SantiMNV avatar SantiMNV commented on July 29, 2024

Thanks! Works for me too

from pdf2image.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.