Long-term archiving · Ruby
Create PDF/A in Ruby
Generate archival-grade PDF/A from Ruby with one method call. rust-pdf embeds the sRGB ICC profile, adds the output intent, writes the XMP metadata and document ID, and enforces the rules, so the output validates under veraPDF, the reference validator.
Last updated: 2026-06-29
Why Ruby needs this
Prawn output is fine for a one-off download, but it is not archival: no embedded ICC profile, no XMP identifier, nothing veraPDF will accept. Ruby teams that owe a regulator long-term files have had to post-process every PDF through Ghostscript.
PDF/A seals every font and colour profile inside the file so it renders identically decades from now, which is why e-invoicing, public-sector, legal and healthcare archives mandate it. rust-pdf produces and validates A-1b, 2b, 2a, 3b, 3a and the PDF 2.0-based A-4, subsetting and embedding fonts for you.
The native lib ships inside the platform gem and loads over Fiddle, so an archiving job on Sidekiq can call doc.pdfa, embed a TTF with add_font_file and rescue RustPdf::Error if the PDF/A license is not active, with no Ghostscript pass anywhere in the pipeline.
- Levels A-1b, A-2b, A-2a, A-3b, A-3a and A-4 (the PDF 2.0 part), with the accessible a-levels building a full tagged structure tree.
- Fonts embedded and subset automatically, ICC profile and output intent added for you.
- XMP metadata kept in sync with the document info, validated by veraPDF.
Create PDF/A in Ruby with rust-pdf
Install with RubyGems, then call the same idiomatic API every rust-pdf binding shares. The snippet below is real Ruby code from the reference docs.
gem install rustpdf
doc = RustPdf::Document.new
doc.pdfa(RustPdf::Pdfa::A2B).info(title: "Q3 Report", author: "Acme Inc.")
f = doc.add_font_file("Roboto-Regular.ttf")
doc.add_page.show_text(f, 20, 72, 760, "Archival report")
doc.save("report_pdfa.pdf") # raises RustPdf::Error without a license granting PDF/A
doc.close
Ruby basic generation is free. PDF/A is a corporate feature, unlocked by one offline license token. See pricing & licensing.
Full Ruby reference in the documentation.
PDF/A in Ruby: FAQ
Which PDF/A levels are supported in Ruby?
rust-pdf creates PDF/A-1b, 2b, 2a, 3b, 3a and 4 (the PDF 2.0-based part, including 4e and 4f). Use a basic b-level for visual fidelity, an a-level for an accessible tagged structure, or a 3-level when you need to embed source files such as an e-invoice XML.
How is conformance verified?
Output is validated with veraPDF, the open-source reference validator for PDF/A, plus qpdf and mutool for structure. The claim is backed by validators, not adjectives.
Do I need a license to create PDF/A in Ruby?
PDF/A is a corporate feature and requires an active license token. Basic generation in Ruby is free. One offline token unlocks PDF/A in every supported language.
Does the gem install on system Ruby on macOS?
Yes. rust-pdf publishes a universal-darwin gem that carries the prebuilt native library, so it installs and loads on the stock macOS Ruby without a Rust toolchain or a compile step, which keeps your archiving jobs deployable.
Make your Ruby documents last for decades
One Rust core, the same output across every language. Prototype for free, license the corporate features when you ship.