Documentation

Getting started

gopdfrab has a small, predictable API: open a document, run a verification profile, read the issues.

The library exposes four things you need to know about: a document you open, a profile describing which checks to run, a result listing what failed, and a conversion that tries to fix it. Everything else is tuning.

If you would rather see it work before reading anything, the browser validator runs the same engine on a file of your choosing without installing anything.

These pages document the API. For the standard itself — what PDF/A requires and why a document fails it — see the guides, and for a specific validation failure, the PDF/A error reference.

InstallAdd the gopdfrab PDF/A library to your Go module with go get, and install the CLI with go install.Open a documentOpen parses a PDF and builds the structures verification needs. Covers the document lifecycle, closing, and why damaged files still open.Verify PDF/ARun PDF/A-1b verification on a path, on in-memory bytes, or across a batch of files concurrently, and read the resulting issues.Convert to PDF/AConvert produces a PDF/A-1b conformant rewrite: pre-emptive fixups, a verify/fix loop, and rasterization as a last resort, with residual issues reported.Encrypted PDFsOpen password-protected PDFs with RC4 40/128, AES-128 and AES-256 support, and handle ErrPasswordRequired cleanly.Typed errorsMatch open, verify and convert failures with errors.Is instead of parsing message text — and see why a damaged PDF is reported, not fatal.Object modelSix checks derived from the Arlington PDF Model answer "is this even valid PDF", independent of any PDF/A conformance level.Options and cancellationThe Context-taking entry points add a context.Context for cancellation and an Options struct for password, DPI, iteration and worker tuning.Resource limitsDecoded-stream and cache budgets guard the parser against decompression bombs. Raise them for large PDFs or lower them to harden against untrusted input.FidelityConforming to PDF/A is not the same as looking like the input. CheckFidelity renders both sides and reports a per-page comparison so content loss is visible.Streaming and batchingSave, WriteTo and Output for single documents; ConvertEach for batches too large to hold in memory, with bounded worker concurrency.Check profilesNarrow verification to the rules you care about. Profiles are immutable clones, safe to share across concurrent calls, grouped by spec area.Inspecting issuesEvery PDFError exposes the Check that flagged it, its page and underlying messages, with helpers for grouping and summarizing a Result.JSON outputResult, PDFError and Check marshal to a stable JSON shape — the same shape the CLI emits under --json.Document helpersShortcuts on an open document: PDF/A compliance, claimed conformance, page count, version, Info dictionary and raw XMP metadata.Legacy Isartor profileLegacy1B is the strict, spec-literal reading of PDF/A-1b; the default PDFA1B profile matches veraPDF's interpretation where the two diverge.