Object-model conformance checks
Checks.ObjectModel holds six checks derived from the Arlington PDF Model, the machine-readable ISO 32000 object model. They answer “is this even valid PDF”, independent of any PDF/A conformance level.
// "Is this even valid PDF?" -- independent of any PDF/A conformance level
res, err := gopdfrab.VerifyObjectModel(path)
res, err = gopdfrab.VerifyObjectModelBytes(data)
res, err = doc.VerifyObjectModel()
// Equivalent to verifying with the object-model-only profile
res, err = doc.Verify(gopdfrab.ObjectModelOnly())
// Shorthand for VerifyObjectModel().Valid
ok, err := doc.IsPDF()This is worth running on its own when PDF/A is not your goal. A file can be perfectly reasonable PDF and still fail PDF/A for reasons that have nothing to do with structural correctness — transparency, say. The reverse is also true: a document can claim PDF/A conformance while containing a dictionary that omits a key ISO 32000 requires. The object-model profile separates the two questions.
ConvertObjectModel is the conversion counterpart: it produces a rewrite repaired against the object-model checks only, applying every fix that is safe and semantics-preserving and reporting anything else as a residual.
// Repairs against the object-model checks only, applying every fix that is
// safe and semantics-preserving and reporting anything else as a residual.
cr, err := gopdfrab.ConvertObjectModel(path)
defer cr.Close()
cr, err = gopdfrab.ConvertObjectModelBytes(data)
cr, err = doc.ConvertObjectModel()