by seanbehan



This webapp turns HTML into a PDF. There are two ways to generate a PDF.

  • You can send a GET request to ./pdf?url=
  • You can send a POST request to ./pdf with the request body being the HTML you'd like to turn into a PDF.

This example uses the HTTPie Python command line tool.

http get localhost:5000/pdf?url=

http post localhost:5000/pdf @sample.html

In both cases you will receive a PDF in the response.

Deploy to Heroku

Deploy to Heroku

Installing wkhtmltopdf

This app requires the wkhtmltopdf binary. If you install this app on Heroku, using the Heroku deploy button above, the app.json 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


There is a demo available at


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=","