Verify a PDF for PDF/A in Go
doc.Verify runs the full PDF/A-1b profile and returns a Result with a single Valid flag and a list of issues. gopdfrab implements that profile as 159 checks across 11 groups, covering ISO 19005-1 clauses 6.1 through 6.9 plus generic ISO 32000 object-model conformance.
v, _ := doc.Verify(gopdfrab.PDFA1B)
if v.Valid {
fmt.Println("Document is PDF/A-1b compliant")
} else {
fmt.Println("Issues:")
for i, issue := range v.Issues {
fmt.Printf("#%v: %v\n", i+1, issue)
}
}You can skip the open step and pass a path directly.
// Verify opens, verifies, and closes a file in one call
result, err := gopdfrab.Verify(path, gopdfrab.PDFA1B)
if err != nil {
log.Fatal(err)
}
fmt.Println(result.Valid)VerifyBytes is Verify for an in-memory PDF — useful when the document arrived over the network and never touched disk.
// VerifyBytes is Verify for an in-memory PDF
result, err := gopdfrab.VerifyBytes(data, gopdfrab.PDFA1B)VerifyAll opens, verifies, and closes a batch of files concurrently. Verification holds no shared mutable state, so this scales across cores — the reference corpus of 773 files completes in well under a second on one machine.
results, err := gopdfrab.VerifyAll(paths, gopdfrab.PDFA1B)
if err != nil {
log.Fatal(err)
}
for _, r := range results {
if r.Err != nil {
log.Println(r.Path, r.Err)
continue
}
fmt.Println(r.Path, r.Result.Valid)
} A Result that is not valid carries every issue found, not just the first — see inspecting issues for reading them, and conversion for fixing them.