agentleFS
ht426ht426/skillseed/skills/processing-pdfs/SKILL.md

processing-pdfs

Skill12 starsChanged 5 months agoMITView on GitHub

从 PDF 文档(尤其发票、收据、报表)中提取表格和文字,输出结构化数据。当用户需要解析 PDF 内容、提取 PDF 表格、读取 PDF 文字、或处理发票/收据数据时使用。触发词:"提取 PDF"、"解析 PDF"、"PDF 表格"、"读取 PDF"、"解析发票"、"extract PDF"。

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. telagod/code-abyss★ 242same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository2 other files it gives its agents.

The file

Files
SKILL.md

processing-pdfs

从 PDF 提取表格和文字内容, 输出结构化数据 (CSV / JSON / Markdown)。聚焦发票、收据、报表类 PDF。

何时使用

当用户想: 从 PDF 提取表格、读取 PDF 文字、解析发票/收据、把 PDF 内容转成结构化数据时。

工作流

1. 确认目标

  • PDF 文件路径 (或用户已打开的文件)
  • 要提取什么: 表格 / 纯文字 / 两者
  • 输出格式: CSV / JSON / Markdown / 直接展示

2. 选工具

加载 references/extraction-tools.md 选工具。速记:

  • 表格: pdfplumber —— 表格提取最稳
  • 文字: PyMuPDF (fitz) —— 比 pdfplumber 快数倍
  • 扫描件 / 图片 PDF: 需 OCR (pytesseract + pdf2image)

3. 提取

  • 先探查 PDF: 页数、是否含可选中的文字 (还是扫描件)
  • 表格: pdfplumber.open(path).pages[i].extract_tables()
  • 文字: page.extract_text() 或 PyMuPDF page.get_text()
  • 发票特有: 字段对齐 (发票号、金额、日期、商品明细) 常需按坐标或正则定位

4. 结构化输出

  • 表格 → CSV 或 Markdown 表
  • 发票字段 → JSON (键值对)
  • 多页 → 合并或分页输出, 注明页码

5. 校验

  • 抽查 1-2 页对照原文, 确认无遗漏 / 错位
  • 表格列对齐正确, 数字无串行
  • 扫描件 OCR 结果须人工复核

References 索引

文件内容何时加载
references/extraction-tools.mdPDF 提取工具用法速查 (pdfplumber / PyMuPDF / OCR) + 发票字段定位技巧步骤 2 选工具时

重要约束

  • 优先用 pdfplumber 提取表格 (最稳); 纯文字用 PyMuPDF 更快
  • 扫描件 (extract_text 返回空) 必须走 OCR, 不要硬用 extract_text
  • 输出前对照原文抽查, 避免静默错位
  • 路径用正斜杠 (含 Windows)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.