跳到主要内容

PDF 处理

收藏0

PDF

读取、生成和检查 PDF 文件,渲染页面核对排版,提取文字与表格。

让 AI 安装

灵栈官方最新版本 0.1.0更新于 2026-10-16下载 16 次

  • PDF
  • 文字提取
  • 表格提取
  • 排版检查
  • 文档生成

SKILL.md

2.5 KB查看排版效果
1---
2name: "pdf"
3description: "Use when tasks involve reading, creating, or reviewing PDF files where rendering and layout matter; prefer visual checks by rendering pages (Poppler) and use Python tools such as `reportlab`, `pdfplumber`, and `pypdf` for generation and extraction."
4---
5
6
7# PDF Skill
8
9## When to use
10- Read or review PDF content where layout and visuals matter.
11- Create PDFs programmatically with reliable formatting.
12- Validate final rendering before delivery.
13
14## Workflow
151. Prefer visual review: render PDF pages to PNGs and inspect them.
16 - Use `pdftoppm` if available.
17 - If unavailable, install Poppler or ask the user to review the output locally.
182. Use `reportlab` to generate PDFs when creating new documents.
193. Use `pdfplumber` (or `pypdf`) for text extraction and quick checks; do not rely on it for layout fidelity.
204. After each meaningful update, re-render pages and verify alignment, spacing, and legibility.
21
22## Temp and output conventions
23- Use `tmp/pdfs/` for intermediate files; delete when done.
24- Write final artifacts under `output/pdf/` when working in this repo.
25- Keep filenames stable and descriptive.
26
27## Dependencies (install if missing)
28Prefer `uv` for dependency management.
29
30Python packages:
31```
32uv pip install reportlab pdfplumber pypdf
33```
34If `uv` is unavailable:
35```
36python3 -m pip install reportlab pdfplumber pypdf
37```
38System tools (for rendering):
39```
40# macOS (Homebrew)
41brew install poppler
42
43# Ubuntu/Debian
44sudo apt-get install -y poppler-utils
45```
46
47If installation isn't possible in this environment, tell the user which dependency is missing and how to install it locally.
48
49## Environment
50No required environment variables.
51
52## Rendering command
53```
54pdftoppm -png $INPUT_PDF $OUTPUT_PREFIX
55```
56
57## Quality expectations
58- Maintain polished visual design: consistent typography, spacing, margins, and section hierarchy.
59- Avoid rendering issues: clipped text, overlapping elements, broken tables, black squares, or unreadable glyphs.
60- Charts, tables, and images must be sharp, aligned, and clearly labeled.
61- Use ASCII hyphens only. Avoid U+2011 (non-breaking hyphen) and other Unicode dashes.
62- Citations and references must be human-readable; never leave tool tokens or placeholder strings.
63
64## Final checks
65- Do not deliver until the latest PNG inspection shows zero visual or formatting defects.
66- Confirm headers/footers, page numbering, and section transitions look polished.
67- Keep intermediate files organized or remove them after final approval.

文件内容是平台检查时读出的文本,只供查看。平台不会运行包里的任何脚本或程序。