Render any Rails view to PDF, exactly as the browser sees it.

A pooled headless Chrome instance instead of an abandoned wkhtmltopdf binary — real CSS, real layout, real fonts, no separate renderer to compile or package.

Any controller action. The same view. A PDF instead of HTML. HtmlToPdf renders the exact view your app already has — the same ERB, the same CSS, the same layout — and converts it with real headless Chrome instead of wkhtmltopdf's years-out-of-date, unmaintained WebKit build. Flexbox, CSS Grid, and modern fonts render the way they actually look in a browser, because it is a browser.

gem install htmlToPdf
class ApplicationController < ActionController::Base
  include HtmlToPdf
  around_action :html_to_pdf
end
<%= link_to "Download PDF", invoice_path(@invoice, format: :pdf) %>

What it does

How it compares

CapabilityHtmlToPdfWickedPdf / PDFKitGroverPrawn
Renders your existing view✓✓✓— (own DSL)
Rendering engineChrome (current)wkhtmltopdf (unmaintained)Chrome via Puppeteern/a
Modern CSS (flexbox/Grid)✓—✓n/a
Extra runtime neededChrome/Chromium onlywkhtmltopdf binaryChrome + Node.js + Puppeteernone
Pooled browser (no per-request spawn)✓n/adepends on setupn/a
around_action-safe callback ordering✓variesvariesn/a

Full breakdown in Choosing a Rails HTML-to-PDF gem.

Guides

Links