0

I have a Python Flask application set up on Heroku which uses pdfkit to convert a .txt file to a .pdf file. pdfkit internally uses wkhtmltopdf as a dependency.

I tried with several wkhtmltopdf buildpacks, but to no avail. pdfkit still cannot find the wkhtmltopdf binary on the server. Last one used: https://elements.heroku.com/buildpacks/dscout/wkhtmltopdf-buildpack

I inspected the /app/bin folder on the heroku deployment and found the binaries present there, which were working as well. (I converted a string to pdf using the wkhtmltopdf binary directly)

I set that path as a OS Environment Param, and initialized pdfkit with the binary parameter pointing to the path where I found the wkhtmltopdf on the server.

path_wkhtmltopdf = os.getenv("WKHTMLTOPDF_PATH")
config = pdfkit.configuration(wkhtmltopdf=path_wkhtmltopdf)

But again, this didn't work.

I am running on a heroku-18 stack.

RwitamB
  • 67
  • 2
  • 11
  • Not sure what your issue actually is, but you can't figure it out, you could perhaps work around it by copying the binary into your project source tree, so you'll know exactly where it is. You may want to keep the buildpack though since it installs some supporting libraries. – Unixmonkey Apr 10 '20 at 15:20
  • Okay, I'll try with the binaries inside my application directly – RwitamB Apr 11 '20 at 09:02

0 Answers0