PDF Tool
Use pdf-tool instead of writing a one-off PDF manipulation script.
Prepare
- Run
command -v pdf-tool. - If missing and this repository is available, run
uv tool install .. Otherwise runuv tool install git+https://github.com/evrenverse/pdf-tool. - Run
pdf-tool --version. - Run
pdf-tool capabilities --jsonandpdf-tool doctor --json. - Use
pdf-tool schema <name>when constructing structured input. - Work on a copy unless the user explicitly wants an in-place edit.
Inspect before editing
- Run
pdf-tool info <file> --json. - For forms, run
pdf-tool field-info <file> --json. - Use
find,read --pages, orread --fields; avoid dumping the complete document when a scoped read is enough.
Edit and verify
- Use
fill --validate-onlybefore filling a form. - Prefer
batchwhen fill, overlay, and signature operations belong in one transaction. - Never put a certificate passphrase in arguments or JSON. Use
--passphrase-fileor thePDF_TOOL_CERT_PASSPHRASEsecret environment variable. - Run
info,read, orfield-infoon the output. - Report the output path and any font, rendering, or signature limitation.
Use zero-indexed page numbers. Keep an untouched copy of important documents.
Read references/cli.md when exact syntax, dependencies, or exit behavior is needed.