OpenParable
Skip to content
← Back to skills

PDF Table Extract

Documents
pdf_table_extract

PDF Table Extract is an Agent Skill for documents published in the cas-bigdatalab/piflow repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

从PDF文件中提取表格数据,输出为JSON格式。当用户需要从PDF中提取表格时使用此skill。

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/cas-bigdatalab/piflow/blob/HEAD/workspace/skills/pdf_table_extract/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/pdf-table-extract, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

pdf_table_extract 技能

功能说明

该技能从PDF文件中提取表格数据,输出为JSON格式,适用于需要从PDF报告中提取结构化表格数据的场景。

核心功能

  • 自动检测并提取PDF中的表格
  • 支持指定页码范围提取
  • 输出结构化JSON格式(包含表头和数据行)
  • 自动创建输出目录

使用方法

python scripts/run_pdf_table_extract.py --input_path <输入PDF> --output_path <输出JSON> [--pages <页码范围>]

参数说明

参数类型必填默认值说明
input_pathstring是-输入PDF文件路径
output_pathstring是-输出JSON文件路径
pagesstring否全部页码范围,如"1-3,5"

示例

示例1:提取全部页面的表格

python scripts/run_pdf_table_extract.py --input_path report.pdf --output_path tables.json

示例2:提取指定页码的表格

python scripts/run_pdf_table_extract.py --input_path report.pdf --output_path tables.json --pages "3-5"

输出格式

[
  {
    "page": 3,
    "headers": ["姓名", "部门", "职位"],
    "rows": [
      {"姓名": "张三", "部门": "技术部", "职位": "工程师"},
      {"姓名": "李四", "部门": "市场部", "职位": "经理"}
    ]
  }
]

注意事项

  • 需要安装pdfplumber库
  • 复杂表格可能提取不准确
  • 输出目录不存在时会自动创建