Skip to content

WickedPDF for Rails or a Rendering API and What a Year Costs

WickedPDF shells out to wkhtmltopdf, an archived WebKit renderer with no CSS grid. At 10,000 PDFs a month an API costs about $588 in year one against about $3,780 for keeping it running.

Live demo

Runs in your browser. Nothing is uploaded. One PDF free to try, then a plan.

Your PDF is downloading. That was the free one. The Starter plan converts as many as you need, for $49 a month or $288 a year, half price.

See the plan

SitePDF is an HTML to PDF API, and this article is for a Rails team that prints invoices or reports with WickedPDF and is deciding whether to keep doing so. The short answer is that WickedPDF is a thin wrapper around the wkhtmltopdf binary, and that binary is no longer maintained, so the real question is what the binary costs you. At 10,000 PDFs a month, an API costs about $588 in year one against about $3,780 for keeping the gem and its binary healthy.

The short answer

WickedPDF renders a Rails view to HTML and pipes it to wkhtmltopdf, which draws it with an old Qt WebKit engine. The gem is easy to install and works well for plain, table based documents. The trouble is the engine underneath. It has no CSS grid, handles flexbox only partly, and splits table rows across pages.

The wkhtmltopdf project was archived in January 2023 and its last release dates from 2020. If your billing views use modern CSS, someone is already maintaining a second print layout, or the PDF looks different from the screen.

What goes wrong with WickedPDF in production?

SymptomCauseUsual fix
Grid or flexbox layout collapsesOld WebKit engine without grid and with partial flexboxRewrite the print view with tables and floats
Table rows cut in half at a page breakKnown page break handling of the engineAdd break rules per row and test every template
Fonts differ from the web appFonts must be installed on the server that runs the binaryInstall and keep fonts in the image
Binary fails after a deploy or OS changeIt needs system libraries and a matching buildPin the binary and rebuild the image
Security review flags the toolNo upstream patches for known issuesBlock outbound requests from the render host

The upstream status is on the wkhtmltopdf repository, and the gem itself is on GitHub as wicked_pdf. For the engine story in more detail, see our wkhtmltopdf alternative page.

What does a year cost, WickedPDF against an API?

These are planning assumptions, not measurements. Take a Rails app that sends 10,000 invoices and statements a month, for example an indexing service such as one that submits large batches of URLs to search engines and bills customers monthly. The rate is $75 an hour and one render counts per document.

Cost lineKeep WickedPDFSitePDF Starter API
Separate print layout without grid or flexbox14 hours, $1,050$0, the web view is reused
Binary, fonts and image set up6 hours, $4504 hours to swap the call, $300
Upkeep when views or the base image change2 hours a month, $1,800$0
Extra server memory for PDF jobs$40 a month, $480$0
Service fee$0$288 billed yearly
Year one$3,780$588

If your invoice is a plain table that nobody touches, the left column falls toward $500 and the gem wins. The right column is fixed by the pricing page: Starter API is $49 a month for 10,000 renders, Growth is $99 a month for 50,000 and Scale is $299 a month for 250,000.

How do you switch from WickedPDF to an API?

Keep your Rails view. Render it to a string, post it, and send the result. Remove the print layout you built only for the old engine.

html = render_to_string(template: "invoices/show", layout: "pdf")

res = Net::HTTP.post(
  URI("https://api.sitepdf.com/v1/render"),
  { html: html, format: "Letter", archive: true }.to_json,
  "Authorization" => "Bearer #{ENV['SITEPDF_KEY']}",
  "Content-Type" => "application/json"
)

Page size is format. Page numbers come from header_html and footer_html, covered in page numbers and footers. With archive set, the render is stored with a SHA-256 hash, useful when a customer disputes an invoice, see invoice PDF archive.

Where do the other Rails options fit?

Grover and Ferrum drive Chromium from your own server, which fixes the engine but moves the browser into your containers, the cost that Docker and Chromium against an API prices. The full set of routes is on the HTML to PDF for Rails page, and the general sums are in library versus API.

Who this is for and who it is not for

It is for Rails teams whose invoices or reports are already web views and who maintain a second layout or a binary just for PDF. It is not for teams that cannot send document content to an outside service, or ones printing a few simple letters a month, where the gem you already run costs nothing.

What to do this week

Send the web view of your most complex document to SitePDF next to your current output. If both match the screen, keep WickedPDF. If you find a table rewrite or a font gap, the API removes that work. Plans are on the pricing page.

Frequently asked questions

Is WickedPDF still maintained?

The gem receives updates, but it calls wkhtmltopdf, whose repository was archived in January 2023. The rendering engine therefore does not get new CSS support or security fixes.

Does WickedPDF support CSS grid?

No. The wkhtmltopdf engine behind it has no CSS grid and only partial flexbox, so those layouts need a table or float rewrite. A Chromium based renderer prints them as the browser does.

What is the best alternative to WickedPDF?

For a Rails app that wants browser accurate output without running Chromium, a hosted API such as SitePDF fits. Teams that prefer to host can use Chromium through a gem, at the cost of managing the browser.

How much does an HTML to PDF API cost for Rails?

SitePDF Starter API is $49 a month for 10,000 renders, or $288 billed yearly. Growth is $99 a month for 50,000 renders and Scale is $299 a month for 250,000. Count one render per document.

Written by the team behind SitePDF, an HTML to PDF API that archives every page it renders. The in-browser converter is free to try, and API plans start at $49 a month, half price billed yearly.

Get started

Render and archive with one API call

A pixel perfect PDF and a dated copy of the page from the same request. Plans from $49 a month, half price billed yearly.

HTML to PDF, in your browser

Buy the plan