Project

forme-ruby

0.0
The project is in a healthy, maintained state
Independent Ruby bindings for the Rust Forme HTML renderer. No browser, Node.js, WebAssembly or separate rendering service.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

~> 0.2
~> 1.17
>= 2.0, < 3
 Project Readme

forme-ruby

CI License: MIT

Render HTML and print CSS to PDF inside Ruby, using the Rust Forme engine. No browser, Node.js, WebAssembly or separate rendering service is needed.

This is an independent MIT-licensed binding maintained by ClearStack, not an official upstream project. 0.1.0 is available on RubyGems.

Getting started

Add to your Gemfile and run bundle install:

gem "forme-ruby", "~> 0.1.0", require: "forme_pdf"

Or install directly:

gem install forme-ruby -v 0.1.0

RubyGems selects a matching native package where available. The same packages and checksums are available in the GitHub release.

require "forme_pdf"

pdf = FormePDF.render_html("<h1>Hello from Ruby</h1>")
File.binwrite("hello.pdf", pdf)

Ruby 3.2 or later is required. Native packages target Apple Silicon macOS 15+ and Linux AMD64 glibc 2.28+ and need no compiler. Source installs require network access to locked upstream dependencies. See installation.

Native platform targets

Native gem Qualification environments
arm64-darwin Apple Silicon macOS 15 and 26
x86_64-linux-gnu Red Hat UBI 8, 9 and 10; Ubuntu 24.04 and 26.04; Arch Linux rolling

Version 0.1.0 passed the full release matrix. Red Hat testing uses official UBI images, not RHEL certification. Linux ARM64, Windows and Alpine/musl binaries are not provided. See the installation guide for Ruby and source-build requirements.

Using Rails

Authorize and select application data first, then render explicitly:

html = render_to_string(template: "invoices/pdf", layout: "pdf", formats: [:html])
send_data FormePDF.render_html(html),
  type: "application/pdf", disposition: "inline", filename: "invoice.pdf"

Rails is optional. The Rails guide also covers the opt-in FormePDF::Rails adapter. The gem installs no middleware or routes.

Learn more

Use trusted HTML and assets. The engine can read local image paths and is not a sandbox for untrusted documents. See security. Report reproducible bugs through GitHub issues with synthetic input, Ruby/platform versions and renderer diagnostics.