Skip to content
Thomas Karner
Menu

Case study · Open source

gopdfrab: PDF/A compliance for Go

A small, fast library for verifying and converting PDF documents to PDF/A-1b – as a Go package, a command-line tool and a WebAssembly build.

204/204

Isartor test suite passed

569/569

veraPDF corpus passed

159

checks in 11 groups

0.27 s

for the whole 773-file corpus

The problem

PDF/A is the standard for long-term archiving of documents – in public administration, notary offices, courts and accounting. Anyone who wants to verify or convert documents automatically usually ends up with Java tools.

Those need a Java runtime, start slowly and are awkward to integrate into Go services, containers or the browser.

The solution

gopdfrab is written in pure Go with zero runtime dependencies. A single static binary contains everything, including the fonts and colour spaces needed for conversion.

The library checks structural integrity against the Arlington model, verifies PDF/A-1b and converts documents – with a rasterisation fallback for pages that can't be repaired in place. Encrypted PDFs (RC4, AES-128, AES-256) are supported too.

Faster than JVM validators

A static Go binary against two JVM validators, on the same 773-file corpus. The JVM tools additionally need a Java runtime of 40–200 MB.

Batch throughput

files/s · higher is better

gopdfrab
2,939
PDFBox Preflight
155
veraPDF
130

Cold single-file latency

ms · lower is better

gopdfrab
9.5
PDFBox Preflight
295
veraPDF
991

Peak memory

MB · lower is better

gopdfrab
80
PDFBox Preflight
945
veraPDF
728
Full benchmarks and methodology ↗

Ways to use it

Go library

Embed it directly in services and batch jobs – with typed errors and a stable JSON shape.

CLI

gopdfrab verify and convert, with exit codes made for scripts and CI pipelines.

WebAssembly

Verification and conversion right in the browser – no document leaves the device.

Getting started

Tested against the full Isartor and veraPDF conformance suites. The API has been stable since 1.0.

main.go
result, err := gopdfrab.Verify("invoice.pdf", gopdfrab.PDFA1B)
if err != nil {
    log.Fatal(err)
}
fmt.Println(result.Valid)
fmt.Println(result.Summary())
shell
go install github.com/voidrab/gopdfrab/cmd/gopdfrab@latest

gopdfrab verify docs/              # verify every PDF in a directory
gopdfrab verify --json report.pdf  # machine-readable output
gopdfrab convert in.pdf out.pdf    # rewrite towards PDF/A-1b

PDF/A-1b is complete. PDF/A-2, -3 and -4 come next.

Try it in your browser

The validator and converter run locally as WebAssembly – your files never leave your device.

Licensing

Dual-licensed: open source or commercial

Choose the licence that fits your project.

AGPL 3.0

Free and open source

  • Free licence
  • Full source code disclosure required
  • No support

Commercial licence

For closed-source and commercial use

  • Paid licence
  • No source code disclosure required
  • Support available
Licensing details ↗

Using gopdfrab in your product?

I issue commercial licences and help you integrate, extend and operate gopdfrab – or analyse problematic document collections.