Giter Site home page Giter Site logo

pdf2image-as-a-service's People

Contributors

belval avatar keherri avatar pankhuriagarwal94 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pdf2image-as-a-service's Issues

OSError: [Errno 8] Exec format error: 'poppler_binaries/pdfinfo'

While running on an Apline docker, I'm getting the error:

`Traceback (most recent call last):
File "venv/lib/python3.10/site-packages/pdf2image/pdf2image.py", line 568, in pdfinfo_from_path
proc = Popen(command, env=env, stdout=PIPE, stderr=PIPE)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 966, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 1842, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: 'poppler_binaries/pdfinfo'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "utils.py", line 94, in pdf_to_images
return convert_from_bytes(
File "venv/lib/python3.10/site-packages/pdf2image/pdf2image.py", line 358, in convert_from_bytes
return convert_from_path(
File "venv/lib/python3.10/site-packages/pdf2image/pdf2image.py", line 127, in convert_from_path
page_count = pdfinfo_from_path(
File "venv/lib/python3.10/site-packages/pdf2image/pdf2image.py", line 594, in pdfinfo_from_path
raise PDFInfoNotInstalledError(
pdf2image.exceptions.PDFInfoNotInstalledError: Unable to get page count. Is poppler installed and in PATH?
Traceback (most recent call last):
File "venv/lib/python3.10/site-packages/pdf2image/pdf2image.py", line 568, in pdfinfo_from_path
proc = Popen(command, env=env, stdout=PIPE, stderr=PIPE)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 966, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 1842, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: 'poppler_binaries/pdfinfo'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "utils.py", line 94, in pdf_to_images
return convert_from_bytes(
File "venv/lib/python3.10/site-packages/pdf2image/pdf2image.py", line 358, in convert_from_bytes
return convert_from_path(
File "venv/lib/python3.10/site-packages/pdf2image/pdf2image.py", line 127, in convert_from_path
page_count = pdfinfo_from_path(
File "venv/lib/python3.10/site-packages/pdf2image/pdf2image.py", line 594, in pdfinfo_from_path
raise PDFInfoNotInstalledError(
pdf2image.exceptions.PDFInfoNotInstalledError: Unable to get page count. Is poppler installed and in PATH?
`

ldconfig not found error

I had trouble running ldconfig when running your build_poppler.sh script. One work around I found was to use apt-get to download poppler directly and cp the relative dependencies using locate.

I can open a PR if that would be something you would find useful.

Memory limit

Hi, do you have the memory limit problem using pdf2img script to convert pdf to images in aws lambda?

Make AWS lambda example more robust

Currently the lambda example will break if the pip version / environment uses Python 3.7, which is not the same as lambda, that uses 3.6. This hinders reproducibility. It should be deployed from a docker container.

Lambda -> libjpeg.so.8: cannot open shared object file: No such file or directory

I'm trying to make this work on AWS Lambda. I'm following the instructions in the README and running the scripts in an AWS instance with the same Amazon-Linux image used by Lambda.

Problem is, when testing the function I get the following error:

pdf2image.exceptions.PDFPageCountError: Unable to get page count. poppler_binaries/pdfinfo: error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory

What could be the cause? Am I doing something wrong?

Poppler binaries not installed

Hi,
I am trying to install poppler binaries on aws lambda using your as-a-function amazon guide.
The directory poppler_binaries is being created but it is empty. Can you please tell how to resolve it?

Suggestion: DigitalOcean

Hi,
you may want to include DigitalOcean as well.
There is this thing called doctl, the Official DigitalOcean Command-Line Client.
Continue the great work!

Error While Using on AWS Lambda

Hello , I tried installing the poppler as per the docker file and deployed the layer. When I try using pdf2image in code , this is what happening , its working fine on my local machine but on lambda I'm getting error . libpoppler.so.73 is there in the layer along with all the other binaries .

Added traceback for the reference :

Traceback (most recent call last):
  File \"/var/task/pdf2image/pdf2image.py\", line 473, in pdfinfo_from_path
    raise ValueError
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File \"/var/task/services/test/pdf2tiffmanager.py\", line 52, in convert_pdf_tiff
    images = convert_from_path(local_save_path, fmt='tiff', use_pdftocairo=True)
  File \"/var/task/pdf2image/pdf2image.py\", line 98, in convert_from_path
    page_count = pdfinfo_from_path(pdf_path, userpw, poppler_path=poppler_path)[\"Pages\"]
  File \"/var/task/pdf2image/pdf2image.py\", line 482, in pdfinfo_from_path
    raise PDFPageCountError(
pdf2image.exceptions.PDFPageCountError: Unable to get page count.
pdfinfo: error while loading shared libraries: **libpoppler.so.73: cannot open shared object file: No such file or directory**

Regards
Ankur

[ERROR] PDFPageCountError: Unable to get page count. pdfinfo: /lib64/libz.so.1: version `ZLIB_1.2.9' not found (required by /opt/lib/libpng16.so.16)

I get the following error when I try to use pdf2image following your example:

[ERROR] PDFPageCountError: Unable to get page count.
pdfinfo: /lib64/libz.so.1: version `ZLIB_1.2.9' not found (required by /opt/lib/libpng16.so.16)

Traceback (most recent call last):
  File "/var/task/index.py", line 33, in handler
    text = extract_text_pdf(image_path)
  File "/var/task/index.py", line 119, in extract_text_pdf
    imgs = pdf2image.convert_from_path(image_path, output_folder=path)
  File "/opt/python/lib/python3.8/site-packages/pdf2image/pdf2image.py", line 97, in convert_from_path
    page_count = pdfinfo_from_path(pdf_path, userpw, poppler_path=poppler_path)["Pages"]
  File "/opt/python/lib/python3.8/site-packages/pdf2image/pdf2image.py", line 471, in pdfinfo_from_path
    raise PDFPageCountError(

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.