Generating PDF from HTML using DocRaptor on Heroku
Summary
One of the libraries that were used at my last job was PrinceXML, which did a great jog generating PDFs from HTML pages. Since PrinceXML is a commercial product, Heroku won’t support it and I did not find anything on the web, that would offer PDF generation as a service. These guys provide a service to convert HTML to XLS or PDF over a webservice interface, extactly what I was looking for. The latest DocRaptor documentation for the Heroku Add-on is decent and it provides some nice examples. One thing that is essential for making the stylesheets work is the media => ‘screen, print’ settings: The simplest solution for generating a PDF is to send an url to the service, so you can re-use all your view logic: One caveat though, you got to have at least two dynos to serve the additional request from DocRaptor!