PDFPageCountError: Unable to get page count. pdfinfo: error while loading shared libraries: liblcms.so.1: cannot open shared object file: No such file or directory

I am trying to upload PDF on streamlit and parse the content of it, the application is deployed on Heroku. I am unable to resolve this error

Hi @Namya_LG,

I’m sorry you are running into this error :slightly_frowning_face: What have you tried so far?

I was just reading through the documentation for pdf2image. It says the PDFPageCountError exception is raised when pdfinfo , which is part of poppler-utils, was unable to get the page count from the PDF file. This is usually due to:

  • An invalid PDF file path
  • A malformed or invalid PDF

I would suggested locating the PDF file and passing the absolute path of the PDF file to pdf2image.

Happy Streamlit-ing! :balloon:
Snehan

I had to install certain buildpacks on Heroku post which it worked.

I also downgraded Heroku-20 to Heroku-18

I think these buildpacks did the job -

Ah, completely non-obvious!

Glad you were able to find the solution after a lot of reading. Hopefully this thread helps users who encounter the same issue in the future. I’ll mark your previous response as the solution for now. :slightly_smiling_face:

Best, :balloon:
Snehan

Can I contribute to this issue and submit an article on how I went about resolving the errors ?

Sounds like a fantastic idea! Feel free to create a new post on the forum or your preferred platform with a detailed write-up and/or share a link to the article :clap:

Awesome!
I will do it then :slight_smile:

1 Like