Comments (11)
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.
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.
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.
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.
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.
@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.
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.
Added Ubuntu 16.04+ mention in 2f8b627
from pdf2image.
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.
Thank you, did work for me too.
from pdf2image.
Thanks! Works for me too
from pdf2image.
Related Issues (20)
- PDFPageCountError: Unable to get page count. I/O Error: Couldn't open file 'C:\Users\cdragomir2\Desktop\dataiku\Non Phub Samples\New folder (3)\007-084841-1 to 31 Dec'22': No error. HOT 5
- pdf2image poppler error in Linux HOT 1
- convert_from_bytes has wrong argument name or docstring
- Missing characters like "Ε Δ ΔΎ δ»" when converting a fillable pdf form to image HOT 6
- Missing py.typed file HOT 4
- Wrong image converted HOT 2
- No source release on pypi for 1.16.3 HOT 1
- Inconsistent results between servers with the same code and PDF file HOT 2
- Problem converting from Image coordinates to PDF coordinates
- Invalid SOS parameters for sequential JPEG
- Adding conda poppler to PATH HOT 1
- Lossless conversion HOT 3
- weird CMYK and text at top of output image
- Missing optional arguments in pdfinfo_from_bytes and pdfinfo_from_path HOT 2
- `Page rot` metadata and `size` param interact incorrectly in convert_from_path() HOT 5
- When a pdf is converted to a picture, it takes up a very small part of the picture
- Add an option to start counter generator at index 0 HOT 1
- FileNotFoundError with poppler_path HOT 1
- Is there way to control rotation?
- Some missing words from converting PDF to Image
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdf2image.