# HexaPDF

> Versatile PDF creation and manipulation for Ruby

Source: https://talira.ai/catalog/hexapdf-0yspeq5s
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library, Command-line tool
- Categories: [documents / pdf / manipulation](https://talira.ai/categories/documents/pdf/manipulation), [documents / pdf / generation](https://talira.ai/categories/documents/pdf/generation), [languages / ruby](https://talira.ai/categories/languages/ruby)
- Platforms: linux, macos, windows[^3]
- Licence: AGPL-3.0-only[^1]
- Pricing: Free and open source[^1][^2]
- Pricing notes: AGPL-3.0 for free; commercial licences EUR 600 per host a year or EUR 300 per VM a year, perpetual with a year of updates.
- Free tier: yes[^1][^2]
- Self-hostable: yes[^3]
- API: yes[^3]
- Creator: Thomas Leitner (gettalong), also the author of kramdown

HexaPDF is a pure Ruby library and command-line tool for creating and changing PDF files. Unlike [Prawn](https://talira.ai/catalog/prawn-ez1y8hgw.md), which only generates new content, it reads existing PDFs too: it merges, splits and reorders pages, fills and creates AcroForm forms with Adobe Reader-like appearances, adds annotations, outlines and attachments, extracts text, images and files, encrypts with AES-256, signs and verifies digital signatures and optimizes file size. For new documents it has a canvas API that maps to PDF operators and a layout engine with flowing text, styles, lists, multi-column layouts and automatic page breaks, with TrueType font subsetting. Thomas Leitner, who also wrote [kramdown](https://talira.ai/catalog/kramdown-5nvdegy1.md), dual-licenses it: AGPL-3.0 with a requirement to keep HexaPDF's producer line in every PDF, or a commercial licence sold per host.

## Links

- Website: https://hexapdf.gettalong.org
- GitHub: https://github.com/gettalong/hexapdf
- Docs: https://hexapdf.gettalong.org/documentation/index.html
- Pricing: https://gettalong.at/hexapdf/

## Problems it solves

- fill in an existing PDF form from my Ruby app and keep the fields looking right in Acrobat
- merge several PDF files into one in Ruby without shelling out to a Java tool
- Prawn can make new PDFs but I need to edit an existing one
- add a digital signature to a PDF from Ruby code
- encrypt a PDF with a password using AES-256 in Ruby
- extract the text and images from PDF pages in a Ruby script
- lay out an invoice PDF with flowing text, columns and automatic page breaks in Ruby
- compress and optimize large PDF files to shrink them
- reorder, rotate or delete pages in a PDF from the command line
- attach files to a PDF or pull out embedded attachments
- a PDF library for Ruby with no native dependencies to compile
- validate the internal object structure of a broken PDF
- create fillable form fields on a PDF I generate

## Features

- pure Ruby with minimal dependencies
- canvas API mapping to PDF operators
- document composition engine with flowing text, styles, lists and columns
- JPEG, PNG and PDF images with transparency
- UTF-8 text with TrueType fonts and subsetting
- AcroForm forms with appearance generation
- annotations and document outlines
- file attachments and extraction
- text and image extraction
- encryption including PDF 2.0 AES-256
- digital signatures: signing and verification
- file size optimization
- PDF object validation
- hexapdf command for merging, splitting, encrypting, decrypting and optimizing
- 100% test coverage

## Limitations

- Requires keeping HexaPDF's producer line in every PDF under the AGPL: a commercial licence removes the requirement[^1]

## Ways to run it

### HexaPDF (AGPL)

You run it, AGPL-3.0-only. Price: free.[^1]

You arrange:

- keeping HexaPDF's producer line in every PDF it creates or changes
- releasing your source under the AGPL when the licence requires it

Self-hosting docs: https://github.com/gettalong/hexapdf/blob/master/LICENSE

### HexaPDF commercial licence

You run it, under a commercial licence. Price: EUR 600 per physical host a year (any number of VMs on it), EUR 300 per virtual machine a year for VM-only deployments; unlimited hosts on request.[^2]

Only in this edition:

- use without the AGPL's conditions
- development, testing, staging and CI hosts without extra licences

Self-hosting docs: https://gettalong.at/hexapdf/

## Capabilities

- Has an API: plan not known
- Has a command line tool: plan not known

## Trust

Overall: 0.34 out of 1.
Signals: backing 0.20, extensibility 0.40.

- created by Thomas Leitner (gettalong), also the author of kramdown

Warnings:

- GitHub activity not fetched yet

## Alternatives

- [Prawn](https://talira.ai/catalog/prawn-ez1y8hgw.md): Pure Ruby library for generating PDFs from code
- [Apache PDFBox](https://talira.ai/catalog/apache-pdfbox-79k8kxaj.md): The Apache PDFBox library is an open source Java tool for working with PDF documents.
- [iText Core](https://talira.ai/catalog/itext-core-hcps5a1v.md): Generate & Manipulate PDFs Effortlessly
- [pdf-lib](https://talira.ai/catalog/pdf-lib-80dtat8x.md): Create and modify PDF documents in any JavaScript environment.
- [pdf-reader](https://talira.ai/catalog/pdf-reader-4twjxc38.md): A PDF parser conforming as much as possible to the PDF specification from Adobe

## Sources

[^1]: https://github.com/gettalong/hexapdf/blob/master/LICENSE (checked 20 Nov 2026)
[^2]: https://gettalong.at/hexapdf/ (checked 20 Nov 2026)
[^3]: https://github.com/gettalong/hexapdf (checked 20 Nov 2026)
