pdf

GitHub

提供PDF文件的读取、创建、编辑、合并、拆分及表单填写等功能。通过结构化文本提取与视觉渲染双重验证,确保内容准确与布局正确,适用于各类PDF处理任务。

skills/pdf/SKILL.md OpenBMB/PilotDeck

Trigger Scenarios

需要解析或提取PDF中的文本和表格数据 需要生成新的PDF文件或修改现有PDF结构

Install

npx skills add OpenBMB/PilotDeck --skill pdf -g -y
More Options

Use without installing

npx skills use OpenBMB/PilotDeck@pdf

指定 Agent (Claude Code)

npx skills add OpenBMB/PilotDeck --skill pdf -a claude-code -g -y

安装 repo 全部 skill

npx skills add OpenBMB/PilotDeck --all -g -y

预览 repo 内 skill

npx skills add OpenBMB/PilotDeck --list

SKILL.md

Frontmatter
{
    "name": "pdf",
    "description": "Read, create, edit, merge, split, rotate, fill, render, and verify workspace PDF files. Use whenever the requested input or deliverable is a .pdf, including extracting text or tables, inspecting metadata and page geometry, generating a new PDF, rearranging pages, filling AcroForm fields, or checking visual layout. Do not use for Google Drive or browser-only PDF workflows."
}

PDF

Work with PDFs through the bundled pdf.sh workflow. Treat structure extraction and visual rendering as complementary: parsed text is evidence about content, while rendered pages are the evidence for layout.

Hard requirements

  • Preserve every input PDF. Write edits to a distinct output unless the user explicitly requests replacement.
  • Use pdfplumber for text, table, image, and coordinate-aware inspection; use pypdf for page structure, metadata, page operations, and AcroForms; use ReportLab for new PDFs.
  • Inspect an existing PDF before changing it. Render it first when layout, page order, form appearance, or visual fidelity matters.
  • Create a new PDF from one executable Python builder. Patch and rerun the same builder rather than accumulating one-off scripts.
  • Never assume successful text extraction proves that a PDF looks correct.
  • Run audit, render every final page with Poppler, and inspect every page PNG at full size before delivery. A montage is only an overview.
  • Fix clipped or overlapping content, missing glyphs, broken tables, incorrect page order, bad image crops, inconsistent page sizes, and wrong page numbers before delivery.
  • Do not depend on Codex-private runtime paths or install Python packages globally.

Read the relevant references

Prepare the runtime

Resolve the directory containing this file as PDF_SKILL_ROOT, then run:

PDF_TOOL="$PDF_SKILL_ROOT/scripts/pdf.sh"
bash "$PDF_TOOL" check || bash "$PDF_TOOL" fix

fix creates an isolated Python environment under ${PDF_SKILL_CACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/pilotdeck-pdf}. Poppler is a system dependency; if pdfinfo or pdftoppm is missing, follow the platform-specific hint printed by fix.

Use the turn-scoped PilotDeck work directory for every intermediate. The host sets PILOTDECK_WORK_DIR; the fallback keeps manual runs internal to the project:

WORKSPACE="${PILOTDECK_WORK_DIR:-$PWD/.pilotdeck/work/manual/<task-slug>}/pdf"
mkdir -p "$WORKSPACE/tmp" "$WORKSPACE/qa"

Keep builders, extracted content, split pages, converted files, inspections, renders, and QA reports in WORKSPACE. Put only requested deliverables in the project or user-selected output directory. Never create QA directories or other intermediates beside the user's files.

Route the request

Choose one route:

  1. Read-only question: inspect or extract only; do not export a modified PDF.
  2. New PDF: scaffold one builder, build, audit, render, inspect, and iterate.
  3. Existing PDF structural edit: inspect and render first, make the smallest page-level change, then audit and render again.
  4. AcroForm task: inspect fields, fill a distinct output, render every affected page, and verify appearances.

Scanned/image-only PDFs may contain no machine-readable text. Do not call that an extraction failure if rendered pages are valid. OCR is not bundled; disclose the limitation or use a separately available OCR workflow when the user requests it.

Inspect or extract

Create a compact structural and content overview:

bash "$PDF_TOOL" inspect \
  --input "$INPUT_PDF" \
  --out "$WORKSPACE/tmp/inspection.json"

Extract full page text and detected tables when needed:

bash "$PDF_TOOL" inspect \
  --input "$INPUT_PDF" \
  --out "$WORKSPACE/tmp/inspection.json" \
  --text-out "$WORKSPACE/tmp/text.json" \
  --tables-out "$WORKSPACE/tmp/tables.json"

Do not load a large extraction wholesale when page-level inspection or targeted searching is enough.

Create a PDF

Scaffold one builder and edit it for the task:

bash "$PDF_TOOL" scaffold --out "$WORKSPACE/tmp/build_pdf.py"
bash "$PDF_TOOL" build \
  --builder "$WORKSPACE/tmp/build_pdf.py" \
  --out "$FINAL_PDF"

The builder must accept --out <path>, work offline, embed or register fonts explicitly, and keep page numbering deterministic. Follow creation.md.

Perform structural operations

bash "$PDF_TOOL" merge --inputs first.pdf second.pdf --out merged.pdf
bash "$PDF_TOOL" split --input source.pdf --out-dir "$WORKSPACE/tmp/pages" --pages "1-3,7"
bash "$PDF_TOOL" rotate --input source.pdf --out rotated.pdf --degrees 90 --pages "2,4-5"

For forms:

bash "$PDF_TOOL" forms-inspect --input form.pdf --out "$WORKSPACE/tmp/fields.json"
bash "$PDF_TOOL" forms-fill \
  --input form.pdf \
  --data "$WORKSPACE/tmp/values.json" \
  --out filled.pdf

These operations preserve the source and do not reflow page content. See structure-and-forms.md.

Validate and render

Run the final structural audit:

bash "$PDF_TOOL" audit \
  --input "$FINAL_PDF" \
  --out "$WORKSPACE/qa/audit.json"

Render every page and optionally create an overview montage:

bash "$PDF_TOOL" render \
  --input "$FINAL_PDF" \
  --out-dir "$WORKSPACE/qa/render" \
  --dpi 144 \
  --montage "$WORKSPACE/qa/montage.png"

Inspect every page-*.png at full resolution. Revise the builder or edit, then rerun audit and render until hard failures are gone and every warning is understood.

After changing this skill or its runtime, run:

bash "$PDF_TOOL" self-test --out "$WORKSPACE/self-test"

Deliver

Return the final PDF and a concise summary. Mention deliberate limitations such as image-only pages, unsupported dynamic forms, signatures, or preserved source defects. Do not deliver builders, extracted text, JSON reports, renders, runtime files, or scratch artifacts unless requested.

Version History

  • a3d1f7c Current 2026-07-23 06:12

Same Skill Collection

skills/1password/SKILL.md
skills/apple-notes/SKILL.md
skills/apple-reminders/SKILL.md
skills/bear-notes/SKILL.md
skills/blogwatcher/SKILL.md
skills/browser-use/SKILL.md
skills/diagram-maker/SKILL.md
skills/frontend-slides/SKILL.md
skills/github/SKILL.md
skills/gog/SKILL.md
skills/himalaya/SKILL.md
skills/karpathy-guidelines/SKILL.md
skills/meeting-recorder-assistant/SKILL.md
skills/notion/SKILL.md
skills/obsidian/SKILL.md
skills/pilotdeck-skills-migration/SKILL.md
skills/powershell/SKILL.md
skills/pptx/SKILL.md
skills/react-next-best-practices/SKILL.md
skills/skill-creator/SKILL.md
skills/spike/SKILL.md
skills/spreadsheets/SKILL.md
skills/summarize/SKILL.md
skills/tmux/SKILL.md
skills/trello/SKILL.md
skills/weather/SKILL.md
skills/docx/SKILL.md
skills/find-skills/SKILL.md
skills/frontend-design/SKILL.md
skills/minimax-pdf/SKILL.md
skills/web-design-guidelines/SKILL.md

Metadata

Files
0
Version
c88d7d1
Hash
cbe2a2a6
Indexed
2026-07-23 06:12

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-04 10:31
浙ICP备14020137号-1 $Гость$