This article was contributed by a member of the Heroku community
Its contents might not always reflect updates to the Heroku platform.
This add-on is operated by BreezyPDF
Generate beautiful PDF documents from the HTML you already have
Last updated 01 October 2018
The BreezyPDF add-on is currently in beta.
Table of Contents
BreezyPDF is an add-on for generating beautiful PDF documents.
Provisioning the add-on
BreezyPDF can be attached to a Heroku application via the CLI:
A list of all plans available can be found here.
$ heroku addons:create breezypdf -----> Adding breezypdf to sharp-mountain-4005... done, v18 (free)
After you provision BreezyPDF, the
BREEZYPDF_SECRET_API_KEY config var is available in your app’s configuration. It contains the secret API key for access to the BreezyPDF API. You can confirm this via the
heroku config:get command:
$ heroku config:get BREEZYPDF_SECRET_API_KEY sk_e4dc1a4d397e7af5b82a38749f3fd1d1
After you install BreezyPDF, your application should be configured to fully integrate with the add-on.
BreezyPDF has complete support for
localhost and other development environments. For the best user experience, make sure to properly configure BreezyPDF for your specific environment’s needs.
After you provision the add-on, it’s necessary to locally replicate its config vars so your development environment can operate against the service.
Use the Heroku Local command-line tool to configure, run, and manage process types specified in your app’s Procfile. Heroku Local reads configuration variables from a
.env file. To view all of your app’s config vars, type
heroku config. Use the following command for each value that you want to add to your
$ heroku config:get BREEZYPDF_SECRET_API_KEY -s >> .env
Credentials and other sensitive configuration values should not be committed to source-control. In Git exclude the
.env file with:
echo .env >> .gitignore.
For more information, see the Heroku Local article.
BreezyPDF can be installed for use in a local development environment. Typically this entails creating another version of the service and pointing the BREEZYPDF_SECRET_API_KEY to this remote service.
Using with Ruby on Rails or other Rack-based web frameworks (Sinatra, Hamani, etc.)
Ruby applications need to add the following entry into their
Gemfile specifying the BreezyPDF client library:
Update application dependencies with bundler:
$ bundle install
Configure the BreezyPDF client:
# config/initializers/breezypdf.rb BreezyPDF.setup do |config| config.secret_api_key = ENV["BREEZYPDF_SECRET_API_KEY"] config.upload_assets = Rails.env.development? end
BreezyPDF is highly configurable depending on your environment’s needs. See the library configuration options here.
Configure Rails to use the BreezyPDF middleware:
# config/application.rb config.middleware.use BreezyPDF::Middleware
Add a link to the web page you’d like to be converted to a PDF:
# view.html.erb <%= link_to "Download as PDF", my_resource_path(format: :pdf) %>
Additional setup and configuration details can be found here.
Using with other languages
Support for additional languages is coming soon.
Monitoring and logging
You can monitor BreezyPDF activity within the Heroku log-stream by filtering for messages containing
$ heroku logs -t | grep 'BreezyPDF'
For more information on the features available within the BreezyPDF dashboard, please see the docs at mysite.com/docs.
The BreezyPDF dashboard allows you to view your rendering usage and configure global options.
You can access the dashboard via the CLI:
$ heroku addons:open breezypdf Opening breezypdf for sharp-mountain-4005
or by visiting the Heroku Dashboard and selecting the application in question. Select BreezyPDF from the Add-ons menu.
Migrating between plans
Application owners should carefully manage the migration timing to ensure proper application function during the migration process.
Migrating between plans will instantly reflect the rendering credits available in the given month.
heroku addons:upgrade command to migrate to a new plan.
$ heroku addons:upgrade breezypdf:standard-1 -----> Upgrading breezypdf:standard-1 to sharp-mountain-4005... done, v18 ($49/mo) Your plan has been updated to:breezypdf:standard-1
Removing the add-on
You can remove breezypdf via the CLI:
This will disable PDF rendering and remove any retained PDFs immediately.
$ heroku addons:destroy breezypdf -----> Removing breezypdf-SLUG from sharp-mountain-4005... done, v20 (free)
Before removing BreezyPDF, ensure that any previously rendered PDFs have been downloaded, and that URLs you’ve shared with your users referencing those PDFs have been updated.