I am in a process of converting HTML files to pdf in python and attach these pdf files to mail and process it
I've installed pdfkit(0.6.1), wkhtmltopdf(0.2) and also wkhtmltopdf for windows. And added wkhtmltopdf bin path. It is working in my local system without any issue here is my code
url="" PDF = pdfkit.from_url(url, False) result= SendPDFtomail(PDF) return result
When I tried to push the same code into heroku by adding the buildpack for wkhtmltopdf and buildpacks for my application are
1. heroku/python 2. https://github.com/dscout/wkhtmltopdf-buildpack.git
When i push my build to heroku
git push heroku master Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 336 bytes | 84.00 KiB/s, done. Total 3 (delta 2), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----> Python app detected remote: ! The latest version of Python 3.6 is python-3.6.6 (you are using python-3.6.4, which is unsupported). remote: ! We recommend upgrading by specifying the latest version (python-3.6.6). remote: Learn More: https://devcenter.heroku.com/articles/python-runtimes remote: -----> Installing requirements with pip remote: remote: -----> wkhtmltopdf app detected remote: -----> Moving wkhtmltopdf binaries to /app/bin remote: -----> Discovering process types remote: Procfile declares types -> web remote: remote: -----> Compressing... remote: Done: 103.8M remote: -----> Launching... remote: Released v19 remote: https://XXXXXXX.herokuapp.com/ deployed to Heroku remote: remote: Verifying deploy... done.
my app was deployed without any issues and when am running the code in Heroku I am getting the error
Exception :No wkhtmltopdf executable found: "b''"
If this file exists please check that this process can read it.
Otherwise please install wkhtmltopdf -
https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf
which is the same error I received when I didn't add the wkhtmltopdf path to the system, As we can see in my build Moving wkhtmltopdf binaries to /app/bin
, how can I make my Heroku configure to this wkhtmltopdf binary path? how can we use config vars in Heroku to make this work
I've tried this generating-pdfs-wkhtmltopdf-heroku but couldn't get it. And wherever I search am getting solutions for ruby that we need to configure the gem file, how can I do it in python
I've been working on it from past two days, Please help me out
Thanks in advance
Meghana Goud
I am now using OSX and heroku to deploy my flask app. When deployed the heroku wkhtmltopdf binary is in ./bin/wkhtmltopdf. So I wrote this code to deal with this.