Portable, verifiable JSON format for mutating a PDF scene graph — the PDF equivalent of JSON Patch (RFC 6902).
{
"spec": "PDFSP/1.0",
"target": "sha256:3a7f...",
"ops": [
{
"op": "replace_text",
"target": "text:'invoice #42'",
"text": "invoice #43"
},
{
"op": "fill_field",
"label": "Total",
"text": "1 250,00 €"
}
],
"contract": {
"only_touch": ["e12", "e13"]
},
"verify": {
"expect": ["invoice #43"],
"absent": ["invoice #42"]
},
…PDFSP defines a portable, verifiable JSON format for describing mutations of a PDF document's scene graph. A patch describes what to change, not how to change it: it can be applied by any conforming engine, replayed on related documents, rebased onto newer revisions, and inverted for rollback.
Address elements by page[2], table[0].row[1].cell[0], section['Résumé'].para[1] or text:'invoice #42' — not fragile coordinates.
only_touch scopes exactly which ids a patch may mutate; violations abort or report contract_violation.
verify.expect / verify.absent run after application — the engine reports checks, not vibes.
meta.atomic: true gives all-or-nothing application; default mode reports every issue and continues.
Every op class has a canonical inverse — rollback without snapshots.
bad_op, target_not_found, stale_target, contract_violation… never a silent failure.