Gate page count, sheet size, footer markers, Chrome print scale (--fills-page 0.9), or blank pages (--min-ink 0.001). Exits 7 on failure.
oyp verify pkg.pdf --pages 12 --size 17x11 \
--text "ISSUED FOR CONSTRUCTION" --text-every-page
oyp exposes OwnYourPDF's C# PDF object layer and vendored stock PDFium engine as a single self-contained command-line tool and stdio MCP server. Every verb emits one JSON object on stdout and exits with a deterministic status code -- no window, no prompt, and zero network calls on any path.
$ oyp version
{"ok":true,"verb":"version","version":"1.0.0","platform":"linux-x64","engine":true,"buildDigest":"9a3a..."}
Every verb prints exactly one JSON object on stdout and exits with a deterministic status code. Pass --pretty for indented output; stderr is not part of the contract. Coordinates are PDF points (1/72 in, origin bottom-left). oyp schema and oyp help <verb> are generated from the parser's own parameter table so they cannot drift from the binary.
{"ok":true,"verb":"measure","file":"/abs/plan.pdf",
"page":1,"points":2,
"length":{"lengthPts":48,"lengthPaperIn":0.667,
"length":1.333333,"unit":"ft","lengthLabel":"1'-4\""},
"scaleSource":"viewport"}
{"ok":false,"verb":"verify",
"error":{"code":"verify_failed",
"message":"pages: expected 2, saw 3"},
"passed":false,
"checks":[{"check":"pages","expected":"2",
"saw":"3","pass":false}]}
| Exit | Meaning | Typical error.code |
|---|---|---|
| 0 | Command succeeded | -- |
| 1 | Failed (write refused, internal error, or version --check hash mismatch) |
internal, build_modified, unsupported |
| 2 | Usage error: unknown verb or option, missing value, bad markup spec | usage |
| 3 | Input file not found or not readable | not_found, unreadable |
| 4 | Password required: none supplied, or --password-file did not open it |
password_required |
| 5 | Pixel engine library not found beside oyp |
engine_missing |
| 6 | Not a valid PDF, or zero readable pages | not_a_pdf, no_pages |
| 7 | verify check failed (override with --fail-exit n if your pipeline expects another code) |
verify_failed |
Gate page count, sheet size, footer markers, Chrome print scale (--fills-page 0.9), or blank pages (--min-ink 0.001). Exits 7 on failure.
oyp verify pkg.pdf --pages 12 --size 17x11 \
--text "ISSUED FOR CONSTRUCTION" --text-every-page
Extract positioned text with bounding boxes, font name, and size (lines, words, chars, plain, or heuristic rows). Decodes CAD subset fonts.
oyp text doc.pdf --mode words
Render pages with annotations to PNG via vendored stock PDFium. Use --pages all --out page-{page}.png or --inline for base64.
oyp render sheet.pdf --page 2 --dpi 100 --out p2.png
Compute calibrated length (or --closed area and perimeter) from the page scale or enclosing detail viewport. Pair with oyp snap.
oyp measure plan.pdf --page 1 --points "144,144 360,144"
Append standard ISO 32000-2 markups (cloud, callout, dimension, area, text, arrow) with appearance streams. Input stays untouched without --in-place.
oyp add-markups plan.pdf --spec markups.json --out review.pdf
Assemble sets with page ranges and outline bookmarks, extract subsets, or split one file per page into --out-dir.
oyp merge --out book.pdf --bookmarks cover.pdf sheets.pdf:2-9
oyp split set.pdf --out-dir parts
oyp mcp speaks stdio JSON-RPC 2.0 with one tool per verb (add_markups, set_print_scaling, etc.) from the same schema table. Calling render without out returns the PNG directly as an image content block.
claude mcp add oyp -- ~/.local/bin/oyp mcp
claude mcp add oyp -- ^
"%LOCALAPPDATA%\Programs\oyp\current\oyp.exe" mcp
Copy or vendor clients/python/oyp.py. Zero pip dependencies; locates $OYP, PATH, or the default install path automatically and raises oyp.OypError with structured .result on failure.
import oyp
pages = oyp.run("info", "pkg.pdf")["pageCount"]
oyp.run("verify", "pkg.pdf", pages=12, size="17x11",
any_orientation=True, text=["ISSUED FOR CONSTRUCTION"],
text_every_page=True)
oyp.run("set-print-scaling", "shop.pdf",
value="none", in_place=True)
Poppler's native C tools (pdfinfo, pdftoppm) beat oyp 2-14x on raw cold-start speed because oyp starts a ReadyToRun .NET runtime (~45-125 ms cold floor). If Poppler already fits your script, keep it. oyp is built for pipelines that want one self-contained binary with a JSON contract, exit-7 verification gates, CAD scale measurements, and append-only writes.
| Cold-Process Job | oyp | Other Tools (Fresh Process) |
|---|---|---|
| Exact page-count gate (500 pages) | 179 ms (245 B out, exit 0/7) | pypdf 218 ms (you write the exit logic) |
| All page sizes (500 pages) | 194 ms (127 KB full info) | pypdf 230 ms · pdfinfo -l 13 ms |
| Words with positions (page 1) | 86 ms | pdfplumber 141 ms |
| Render page 1 at 100 dpi PNG | 126 ms | pypdfium2 140 ms · pdftoppm 56 ms |
| Merge two files | 98 ms | pypdf 113 ms |
493 Core unit tests (including offline Ed25519 licensing), 138 Avalonia headless UI/PDF/native tests, and 41 oyp CLI/MCP tests passing on CI, backed by structural and pixel oracle checks.
A passing 500-page oyp verify gate emits 245 bytes of JSON (vs. 127 KB for info). Failed gates exit 7 naming expected vs. observed per page, catching Chrome/Skia print shrink-to-fit (e.g. scale 0.731 via --fills-page 0.9) and blank pages (--min-ink 0.001).
Vendored stock PDFium 156.0.8076.0 across Windows x64, Linux x64, Linux arm64, macOS arm64, and macOS x64 (macOS x64 verified under Rosetta 2 only; not yet run natively on Intel Mac hardware).
Inputs are read once in full share mode so open files are never locked. Edits append a revision preserving digital signatures and untouched markups, then re-read through both our parser and PDFium before atomic rename.
Building from source requires the .NET 10 SDK; the installed binary is self-contained and needs nothing at runtime. Both installers smoke-test rendering before linking, store builds content-addressed with SHA256SUMS, and emit a reproducible buildDigest verifiable via oyp version --check.
tools/install-cli.sh --add-to-path
# -> ~/.local/share/oyp/builds/<ver>-<sha8>/
# -> ~/.local/bin/oyp -> current/oyp
powershell -NoProfile -ExecutionPolicy Bypass \
-File tools/install-cli.ps1 -AddToPath
# -> %LOCALAPPDATA%\Programs\oyp\current\oyp.exe
oyp does not convert HTML to PDF (keep Chrome or Playwright, then gate the output with oyp verify --fills-page 0.9), does not run OCR on scanned pages (text returns empty honestly), does not print to hardware devices, does not reconstruct ruled tables, and does not decode QR codes. Password-protected PDFs are supported via --password-file <file> (never argv).