Use the deterministic PDF CLI for common creation and transformation tasks. Preserve source files and write transformed PDFs to new paths.
Runtime
Prefer workspace dependency Python. Otherwise use Python 3:
On macOS/Linux use python3; on Windows PowerShell use py -3 (or the
workspace dependency loader's absolute python.exe path). On Windows set the
skill directory with $env:SKILL_DIR = '<skill-directory>'. Every python3
example below uses this platform-specific launcher substitution.
python3 "$SKILL_DIR/scripts/bootstrap.py" <command> [arguments]
py -3 "$env:SKILL_DIR\scripts\bootstrap.py" <command> [arguments]
Missing packages are installed from the hashed lock into ~/.wegent-executor/plugin-envs/wework-public/pdf/, never globally.
Workflow
- Run
inspect --textorextractto understand an input PDF. - For new PDFs, author a JSON specification following spec.md, then run
create. - Use
merge,split, orrotatefor page-level transformations. - Run
validateon the final PDF. - Run
renderand inspect every output page image before delivery when layout matters.
Commands
python3 "$SKILL_DIR/scripts/bootstrap.py" inspect --input source.pdf --text --output inspection.json
python3 "$SKILL_DIR/scripts/bootstrap.py" extract --input source.pdf --tables --output extraction.json
python3 "$SKILL_DIR/scripts/bootstrap.py" create --spec report.json --output report.pdf
python3 "$SKILL_DIR/scripts/bootstrap.py" merge --inputs first.pdf second.pdf --output merged.pdf
python3 "$SKILL_DIR/scripts/bootstrap.py" split --input merged.pdf --pages '1-3,5' --output selection.pdf
python3 "$SKILL_DIR/scripts/bootstrap.py" rotate --input source.pdf --degrees 90 --pages '2' --output rotated.pdf
python3 "$SKILL_DIR/scripts/bootstrap.py" validate --input result.pdf
python3 "$SKILL_DIR/scripts/bootstrap.py" render --input result.pdf --output-dir rendered
Quality rules
- Do not overwrite input PDFs.
- Preserve page order intentionally and use 1-based page selections.
- Treat extracted text as an interpretation of PDF drawing instructions; verify tables and reading order against rendered pages.
- Warn when a PDF is encrypted or content extraction is incomplete.
- A structurally valid PDF still requires visual inspection when it is user-facing.