Anybody was able to get wkhtmltopdf working on Heroku?

422 views Asked by At

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.

0

There are 0 answers