Enterprise PDF for Go
The enterprise PDF library
Go doesn't have.
Generate archival PDF/A, sign documents with PAdES, encrypt with AES-256 and produce accessible PDF/UA from idiomatic Go. 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.
Add the module. A prebuilt static library ships inside it, nothing to compile.go get github.com/rustpdf/rustpdf-go@latestWhy Go teams pick rust-pdf
Go runs the services that emit invoices, statements and e-invoices at scale, but its PDF story stops at drawing boxes and text. PDF/A archival, qualified signatures, AES-256 and PDF/UA aren't there, so teams shell out to headless Chrome or pay a per-document SaaS that uploads their documents.
rust-pdf is one go get with a prebuilt static
libpdf_ffi.a bundled in the module (cgo, nothing to compile),
an idiomatic Document / EditableDoc API, with every feature free.
- Native, not headless Chrome: no browser process, no gigabytes of RAM per worker.
- Runs on your servers: documents never leave your network and nothing phones home, ideal for LGPD/GDPR, fintech and health.
- No AGPL trap: MIT licensed, 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: every feature is free forever.
Every feature is free.
Prototype and ship everyday PDFs for free. PDF/A, signatures, encryption and accessibility are all included in Go and every other binding.
Core free
- Pages & vector graphics
- Embedded/subset fonts, Unicode shaping
- Justified paragraphs & tables
- Images (JPEG/PNG/alpha/16-bit)
- Merge / split / rotate
- Text extraction & optimize
Advanced free
- 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
Every feature is free.
rust-pdf is MIT licensed — PDF/A, digital signatures, encryption, accessibility and page rendering are all included. No key, no account, no card.
Author a tagged PDF/A in a few lines of Go
// go get github.com/rustpdf/rustpdf-go@latest
import rustpdf "github.com/rustpdf/rustpdf-go"
doc, _ := rustpdf.New()
defer doc.Close()
doc.PdfaLevel(rustpdf.A2a)
doc.Tagged()
doc.SetInfo(rustpdf.Info{Title: "Q3 Report"})
f, _ := doc.AddFontFile("Roboto-Regular.ttf")
doc.AddPage()
doc.ShowText(f, 26, 72, 760, "Annual report", 1) // heading level 1 = H1
data, _ := doc.ToBytes() // archival-grade, accessible PDF
The full Go reference (fonts, images, forms, manipulation, encryption and signatures) lives in the Go docs.
Fits Gin, Echo and your net/http handlers
ToBytes() returns a []byte, so serving a PDF is a
w.Write(data) in a net/http handler, a Gin
c.Data(...) or an Echo c.Blob(...) with the
application/pdf content type. No temp files, no shelling out to
wkhtmltopdf, no headless browser to babysit.
The module ships a prebuilt static libpdf_ffi.a linked through
cgo, so go get is all you need. Each Document and
EditableDoc holds its own native handle, so building documents
in parallel goroutines is safe: give each goroutine its own handle and
defer doc.Close().
// net/http: write a PDF/A directly to the response
func invoice(w http.ResponseWriter, r *http.Request) {
doc, _ := rustpdf.New()
defer doc.Close()
doc.PdfaLevel(rustpdf.A2b)
f, _ := doc.AddFontFile("Roboto-Regular.ttf")
doc.AddPage()
doc.ShowText(f, 18, 72, 760, "Invoice #1024", 0)
data, _ := doc.ToBytes()
w.Header().Set("Content-Type", "application/pdf")
w.Write(data)
}
Common PDF tasks in Go
Focused, copy-paste guides in Go, all backed by the same Rust core. Pick a task and the rest share the exact same API shape.
- Generate a PDF in Go and sign it with PAdES.
- Create PDF/A in Go and encrypt with AES-256.
- Merge PDFs, extract text and compress.
- Fill PDF forms in Go, plus concept hubs: PDF/A, PAdES, AES-256.
Start building in Go
go get github.com/rustpdf/rustpdf-go@latest and ship your first
archival PDF today. Every feature is free.
Go PDF library FAQ
Does it use cgo, and do I need CGO_ENABLED=1?
Yes. The binding links a prebuilt static libpdf_ffi.a through cgo, so builds need CGO_ENABLED=1 and a C toolchain on the build machine. There is no Rust toolchain or PDF system tool to install; the native core is already compiled inside the module.
Can I render documents concurrently across goroutines?
Yes. Documents share no global state. Give each goroutine its own Document or EditableDoc and defer its Close(); then you can fan out invoice or statement generation across all cores safely.
What about cross-compilation?
Because it is cgo with a per-platform static library, you build for the target platform you intend to run on (Linux, macOS or Windows) rather than cross-compiling from a single host. The output is one self-contained binary with the PDF engine linked in.