Repair structural defects in PDF bytes, reporting every change as a loss.
Use describe("pdf.repair") when your code needs the complete live JSON Schemas.
At a glance
| Property | Value |
|---|---|
| Package | @runstamp/pdf |
| Domain / verb | pdf / repair |
| Customer jobs | repair, transform |
| Deterministic | Yes |
| Side effects | none |
Availability
| Local | SDK | CLI | MCP | Managed API |
|---|---|---|---|---|
| public ga | public ga | public ga | public ga | public ga |
Managed API route: POST /api/v2/operations/pdf/repair. Managed execution requires a free-trial workspace or an active Platform or Enterprise workspace, and an environment-bound API key.
Input and result
| Schema | Required fields | Optional fields |
|---|---|---|
| Input | none | none |
| Options | none | deterministic, deterministicSeed, timeoutMs, locale, lossPolicy, limits |
| Result value | bytes, mediaType, extension, byteLength, hash | none |
Every success also carries losses, diagnostics, and a hash-bound receipt.
Defaults, limits, and format constraints
Defaults
| Path | Default |
|---|---|
$.deterministic | default=true |
$.lossPolicy | default="collect" |
Formats and profiles
No separate format selector is declared. Accepted artifacts are bounded by the exact input schema.
Other limits
| Path | Constraint |
|---|---|
$.timeoutMs | minimum=1 |
$.limits.maxInputBytes | minimum=1 |
$.limits.maxOutputBytes | minimum=1 |
$.limits.maxPages | minimum=1 |
$.limits.maxElements | minimum=1 |
$.limits.maxArchiveEntries | minimum=1 |
$.limits.maxExpansionRatio | minimum=1 |
$.limits.maxDurationMs | exclusiveMinimum=0maximum=2147483647 |
Invoke
const input = await fetch("https://runstamp.com/demo-evidence/operation-evidence/pdf/pdf.repair/input.json").then((response) => response.json());
const result = await runstamp.run("pdf.repair", input);
if (!result.ok) throw new Error(`${result.error.code}: ${result.error.remediation}`);
console.log(result.value, result.losses, result.diagnostics, result.receipt);curl -fsS https://runstamp.com/demo-evidence/operation-evidence/pdf/pdf.repair/input.json -o input.json
npx -p @runstamp/sdk runstamp ops invoke pdf.repair --input input.json{
"tool": "runstamp_invoke_operation",
"arguments": {
"operation": "pdf.repair",
"input": "<JSON from https://runstamp.com/demo-evidence/operation-evidence/pdf/pdf.repair/input.json>",
"execution_mode": "local"
}
}Errors and losses
Declared errors (8)
common/SCHEMA_REJECTEDcommon/CONTRACT_VIOLATIONcommon/OPERATION_CANCELLEDcommon/OPERATION_TIMEOUTcommon/RESOURCE_LIMIT_EXCEEDEDpdf/LOSS_POLICY_VIOLATEDcommon/UNSUPPORTED_FEATUREcommon/INPUT_CORRUPT
Declared losses (1)
pdf/REPAIR_APPLIED
SDK AbortSignal, CLI exit 130, and MCP cancellation return the typed common/OPERATION_CANCELLED failure envelope.
Verified example and exact contract
- Fixture:
icp-workflow(ITGC audit PDF with a controlled incorrect page-tree count). - Example input — SHA-256
5a4deb74801fd5fbc2fb3339ded52c7530f131494338ef57e1a3b46272a6a0ca. - Example result — SHA-256
eb57f7bea89e6dbf92c5d0d497fb00041760270990e642ca3698b16e7049ff79. - Verified result SHA-256:
3e9f65c4845d704fc185a3ab9be362630979e2340c84b0265650a85af9a481a3. - Qualification lane:
11-pdf-xlsx.
Contract fingerprints
- Descriptor:
0b8beae3897426151cd52d0b653a2f15068e6191a4167472f8e4fb7f52c5bcd4. - Input schema:
862106739c7360a1f6f1513712f1fa453d315c205829370d9cd536df88f6ffb0. - Options schema:
8892cfc286bf399e1958f7d151ff3530b5ca269681a61a4bff88fbfeb9fb5b40. - Result value schema:
e7e0bc52bf866264c04c0cc2a2d2d788751a82a731f6a8bc31b2efb72d06d08c.
The machine-readable operation reference publishes the complete schemas, qualification results, and evidence bindings for every operation.