This webapp turns HTML into a PDF. There are two ways to generate a PDF.
This example uses the HTTPie Python command line tool. https://github.com/jkbrzt/httpie
http get localhost:5000/pdf?url=http://example.com http post localhost:5000/pdf @sample.html
In both cases you will receive a PDF in the response.
This app requires the wkhtmltopdf binary. If you install this app on Heroku, using the Heroku deploy button above, the
will install the necessary buildpacks.
If you're running it somewhere else, you will have to install
wkhtmltopdf and set the environment variable
WKHTMLTOPDF. It has to point to the path of the binary.
For instance if you are on OSX and installing the wkhtmltopdf
.pkg, it's probably at
/usr/local/bin/wkhtmltopdf. You would then boot up a development server like so...
WKHTMLTOPDF=/usr/local/bin/wkhtmltopdf python app.py
There is a demo available at http://htmltopdfdemo.herokuapp.com
The app supports CORS headers, for Cross domain services. You can specify a list of domains using the following ENV var CORS_DOMAINS
e.g. heroku config:set CORS_DOMAINS="www.domain1.com,my.domain2.org"