Enterprise PDF for Ruby

The enterprise PDF library
Ruby doesn't have.

Generate archival PDF/A, sign documents with PAdES, encrypt with AES-256 and produce accessible PDF/UA from idiomatic Ruby. One memory-safe core, the same behavior as every other binding, running entirely on your servers: no per-document SaaS fees, no data leaving your network, no AGPL strings.

Install from RubyGems. Platform gems bundle the native core, nothing to compile.
gem install rustpdf
Validated by independent tools: veraPDFpdfsigopenssl cmsqpdfmutool

Why Ruby teams pick rust-pdf

Rails apps generate invoices, statements and contracts every day, but the usual toolkit stops short of compliance. Prawn draws beautifully yet has no PDF/A, no qualified signatures and no PDF/UA, so teams fall back to wkhtmltopdf or headless Chrome, or pay a per-document SaaS that uploads their documents.

rust-pdf is a gem with the native core bundled in a platform-specific build, loaded through Ruby's Fiddle (no native build step), with a single offline license that unlocks the corporate features.

  • Standards-grade, not just pretty: real PDF/A, PAdES and PDF/UA on top of clean drawing.
  • Runs on your servers: documents never leave your network and nothing phones home, ideal for LGPD/GDPR, fintech and health.
  • No AGPL trap: a commercial per-application license, never the AGPL of iText or the per-server billing of Aspose.
  • Deterministic output: the same input always produces the same bytes, so you can diff and audit it.
  • Free to build with: everyday PDF generation is free forever; you only license the regulated-grade features.

Free to build with. Licensed when you ship.

Prototype and generate everyday PDFs for free. When you need archival, signatures, encryption or accessibility, one license unlocks them all in Ruby and every other binding.

Community free

  • Pages & vector graphics
  • Embedded/subset fonts, Unicode shaping
  • Justified paragraphs & tables
  • Images (JPEG/PNG/alpha/16-bit)
  • Merge / split / rotate
  • Text extraction & optimize

Corporate licensed

  • PDF/A: 1b / 2b / 2a / 3b / 3a / 4 / 4e / 4f archival
  • Digital signatures: PKCS#7, visible & multiple
  • PAdES: B-B / B-LT / B-LTA + RFC 3161 timestamps
  • Encryption: RC4 / AES-128 / AES-256 (R6)
  • Accessibility: Tagged PDF / PDF/UA-1
  • AcroForm: fields with generated appearances
  • Validate & convert: verify signatures, PDF→PDF/A, ZUGFeRD/Factur-X
  • Process: redaction, image extraction, form fill/flatten, page→PNG

Try every licensed feature free for 5 days.

Get a trial token by email and unlock PDF/A, digital signatures, encryption and accessibility in Ruby. No account, no card required.

Author a tagged PDF/A in a few lines of Ruby

# gem install rustpdf
doc = RustPdf::Document.new
doc.pdfa(RustPdf::Pdfa::A2A).tagged.info(title: "Q3 Report")
f = doc.add_font_file("Roboto-Regular.ttf")
doc.add_page
   .show_text(f, 26, 72, 760, "Annual report", heading_level: 1)
data = doc.to_bytes               # archival-grade, accessible PDF

The full Ruby reference (fonts, images, forms, manipulation, encryption and signatures) lives in the Ruby docs.

Fits Rails, Sinatra and Sidekiq

to_bytes returns a binary string, so a Rails controller serves it with send_data bytes, type: "application/pdf", and Sinatra does the same with a content_type header. Generate invoices, statements and contracts inline, or push the work to a Sidekiq or GoodJob background job and store the result.

gem install rustpdf installs a platform gem with the native core bundled and loaded through Ruby's Fiddle, so there is no native build step and no C extension to compile. It drops into an existing Prawn codebase wherever you need PDF/A, signatures or PDF/UA.

# Rails: send a PDF/A from a controller action
def invoice
  doc = RustPdf::Document.new
  doc.pdfa(RustPdf::Pdfa::A2B)
  f = doc.add_font_file("Roboto-Regular.ttf")
  doc.add_page.show_text(f, 18, 72, 760, "Invoice #1024")
  send_data doc.to_bytes, type: "application/pdf", disposition: "inline"
end

Common PDF tasks in Ruby

Focused, copy-paste guides in Ruby, all backed by the same Rust core. Each one uses the same Document / EditableDoc API.

Start building in Ruby

gem install rustpdf and ship your first archival PDF today. Free for everyday generation; license the corporate features when you go to production.

Ruby PDF library FAQ

Does installing the gem compile a C extension?

No. gem install rustpdf installs a platform gem with the native core already built, loaded at run time through Ruby's Fiddle. There is no make, no compiler toolchain and no system PDF tool required.

How do I return the PDF from Rails?

to_bytes returns a binary string, so use send_data doc.to_bytes, type: "application/pdf" with disposition: "inline" to preview or "attachment" to download. For heavy reports, build it in a Sidekiq job and store or email the result.

Can I keep using Prawn?

Yes. Many teams keep Prawn for existing layouts and reach for rust-pdf exactly where Prawn stops: PDF/A archival, PAdES signatures, AES-256 encryption and tagged PDF/UA. They coexist in the same app.