Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Sample Rails app for creating PDFs on Heroku
Branch: master

update to wkhtmltopdf-0.10.0_beta5

also fix passing of "quiet" param for newer wkhtmltopdf
latest commit 1abf9a8481
Jordan Brough authored
Failed to load latest commit information.
app fix breakfast sample nav styling
bin update to wkhtmltopdf-0.10.0_beta5
config small cleanup
db blank heroku bamboo rails app
script blank heroku bamboo rails app
test columns test
vendor/plugins/wicked_pdf update to wkhtmltopdf-0.10.0_beta5
.gems blank heroku bamboo rails app
README.markdown asset_host handling for pdf file paths
Rakefile blank heroku bamboo rails app


Heroku PDF Generation

Working Sample:

Based on


A rails sample app that generates PDFs from html, works on and is so painless it hurts.

Install steps:

  • sudo gem install heroku (if not already installed)
  • git clone git://
  • cd heroku-pdf
  • heroku create your-great-app-name --stack bamboo-ree-1.8.7
  • git push heroku master
  • visit

Presto pdf.

Running locally

The app is setup to use rails-root/bin/wkhtmltopdf-amd64 in production via this initializer code. This setting is overridden in development to look for /usr/local/bin/wkhtmltopdf in development mode (via this after_initialize block). If you want to run in development mode and are on an amd64 architecture you can just delete the after_initialize block. Otherwise, you'll probably want to grab wkhtmltopdf and update the after_initialize path as appropriate.

Asset Paths

Due to how wicked_pdf invokes wkhtmltopdf (the html file is supplied via stdin rather than as a url) all asset urls need to be absolute file paths rather than relative urls. For Rails usage, we can use ActionController::Base.asset_host to switch the path when the request format is pdf. (see here). We also need to extract any urls out of static stylesheets and put them into Rails templates instead so that the path can be swapped out to a file path when necessary. Example:

<style type="text/css" media="screen">
  #menu a {
    background: url(<%= image_path('menu.gif')%>) no-repeat;

wkhtmltopdf version

Currently includes wkhtmltopdf version 0.9.9 static amd64 (works on heroku).

Something went wrong with that request. Please try again.