I am trying to use the pdf2image library, specifically the convert_from_bytes method to convert a pdf to a txt file using pytesseract. My app runs locally, but I want to deploy the app to heroku. I have tried adding python-poppler to my pipfile, but it during deployment it fails to download. I have been trying to use the buildpack https://github.com/survantjames/heroku-buildpack-poppler.git, however when I try to use the app I get this error in the logs.
2021-02-24T02:02:07.068105+00:00 app[web.1]: pages = convert_from_bytes(file,500)
2021-02-24T02:02:07.068106+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/pdf2image/pdf2image.py", line 270, in convert_from_bytes
2021-02-24T02:02:07.068124+00:00 app[web.1]: return convert_from_path(
2021-02-24T02:02:07.068131+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/pdf2image/pdf2image.py", line 97, in convert_from_path
2021-02-24T02:02:07.068132+00:00 app[web.1]: page_count = pdfinfo_from_path(pdf_path, userpw, poppler_path=poppler_path)["Pages"]
2021-02-24T02:02:07.068132+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.8/site-packages/pdf2image/pdf2image.py", line 471, in pdfinfo_from_path
2021-02-24T02:02:07.068133+00:00 app[web.1]: raise PDFPageCountError(
2021-02-24T02:02:07.068133+00:00 app[web.1]: pdf2image.exceptions.PDFPageCountError: Unable to get page count.
2021-02-24T02:02:07.068134+00:00 app[web.1]: pdfinfo: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
What can I do to get poppler installed on heroku, and working in my app? Thanks!