image-pdf-structured-extractor

Extract auditable structured fields from image-based, scanned, hybrid, or native-text PDFs and deterministically map each field's evidence back to the original PDF page number, page label, bbox, original text, and evidence screenshot. Intended for contracts, reports, manuals, forms, and research materials requiring custom JSON Schema and per-field provenance; uses MinerU as the default primary parser, Docling as a required cross-checker, and PaddleOCR as an optional supplementary parser.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "image-pdf-structured-extractor" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-645c2ecfbf4d2a12a97f8a51a7baa0d9295892589aad2b6a501b2b75af681871. Verify the upstream source and version against https://skillhub.cn/skills/user_aa7cd739/image-pdf-structured-extractor before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Extract auditable structured fields from image-based, scanned, hybrid, or native-text PDFs and deterministically map each field's evidence back to the original PDF page number, page label, bbox, original text, and evidence screenshot. Intended for contracts, reports, manuals, forms, and research materials requiring custom JSON Schema and per-field provenance; uses MinerU as the default primary parser, Docling as a required cross-checker, and PaddleOCR as an optional supplementary parser.

0 Downloads

Introduction source: third_party · user_aa7cd739 · 1.1.1 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Inputs and outputs
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: image-pdf-structured-extractor
display_name: 图片型 PDF 结构化抽取
version: 1.1.1
description: 从图片型、扫描型、混合型或原生文本 PDF 中提取可审计的结构化字段,并把字段证据确定性映射回原始 PDF 页码、页标签、bbox、原文和证据截图。用于合同、报告、手册、表单、研究资料等需要自定义 JSON Schema 和逐字段溯源的 PDF 抽取任务;默认以 MinerU 为主解析器、Docling 为必装交叉复核器,PaddleOCR 为可选补充解析器。

图片型 PDF 结构化抽取

核心约束

  • 要求用户提供 PDF、JSON Schema 和输出目录;不得默认绑定任何业务 schema。
  • 只允许 LLM 返回字段值、source_block_ids、字段状态和备注。
  • 由程序根据 block_id 回填物理页码、打印页标签、bbox、原文、解析器、置信度和证据截图;不得让 LLM 生成页码。
  • 将无直接证据的值标记为 inferred、not_found、unreadable 或 manual_review,不得伪装为 verified。
  • 默认禁用外部 LLM 和视觉模型请求;仅在用户显式允许网络且配置完整时启用。
  • 不以 01–08 文件是否全部存在作为完成条件。只检查用户要求的交付物、Schema 校验结果和字段证据一致性。

必装解析器

MinerU 和 Docling 是运行本 Skill 的必装项。PaddleOCR 是可选补充项。

首次部署或更新环境时,完整阅读 国内镜像安装说明,并执行 scripts/install_windows.ps1。安装流程必须:

  1. 从国内 PyPI 镜像安装基础依赖、MinerU 和 Docling;
  2. 通过 ModelScope 下载 MinerU 模型;
  3. 预下载 Docling PDF 模型;
  4. 验证 mineru --help 和 import docling;
  5. 仅在用户需要时安装 PaddlePaddle 与 PaddleOCR。

Windows 环境还必须验证 import onnxruntime。安装脚本会安装 venv 内的 msvc-runtime 并注册启动时预加载,禁止用覆盖系统 DLL 的方式修复依赖。

MinerU 或 Docling 未安装时,不得把环境标记为部署完成,也不得把 Native 解析结果冒充二者的成功结果。

输入

  • --input:PDF 路径;
  • --schema:用户指定的 JSON Schema 路径,必填;
  • --output:输出目录;
  • --config:可选 YAML 配置;
  • --parser:auto、mineru、docling、paddleocr 或 native;
  • --skip-llm:只生成证据层,不执行字段抽取;
  • --enable-network:显式允许外部 LLM/视觉模型请求。

可使用 schemas/generic_fields.schema.json 作为通用示例,但不得假设它适合用户的业务字段。

执行流程

  1. 校验 PDF、Schema、配置和输出目录,并计算 PDF SHA-256。
  2. 检查每页原生文本量、图像覆盖率、页标签和页面尺寸。
  3. 渲染页面,保持原始物理页顺序。
  4. 默认运行 MinerU 主解析和 Docling 交叉复核;按需运行 PaddleOCR。
  5. 将各解析器结果归一化为稳定的 block_id、页码、bbox、原文、置信度和来源哈希。
  6. 仅把带 block_id 的证据块交给 LLM;按用户 Schema 抽取字段。
  7. 由程序回填证据并执行 JSON Schema 校验。
  8. 对解析冲突、未知 block_id、越界 bbox、低置信页和缺少直接证据的字段进行质量检查。
  9. 生成用户要求的结果、证据数据和人工校准材料;不得要求固定的全套编号文件才能交付。

运行稳定性守卫

  • 启动 MinerU 时必须把 127.0.0.1、localhost、::1 合并进 NO_PROXY/no_proxy,避免本地任务 API 被系统代理转发成 502。
  • 只有解析器状态为 success 且 processed_pages == expected_pages 时,才允许作为成功主解析器;partial_success、错误页或页数不符一律记为 partial。
  • Docling 2.113 及以上不再接受 save_as_markdown(..., traverse_pictures=...);使用适配器的兼容回退,不要为此强行固定旧版本。
  • Docling 出现 std::bad_alloc 时,先降低 batch/queue,原生文本 PDF 可关闭 Docling OCR,不需要表格时关闭表格结构;不得把残缺结果称为完整交叉复核。
  • 安装、代理、模型镜像或内存故障时,读取 国内镜像安装说明 的“实测故障与处理”。

证据格式

统一证据块至少包含:

{
  "block_id": "p0012-mineru-0007",
  "parser": "mineru",
  "pdf_page_index": 11,
  "pdf_page_number": 12,
  "printed_page_label": "10",
  "bbox": [126.0, 418.0, 1028.0, 476.0],
  "text": "原文证据",
  "confidence": 0.97,
  "source_hash": "sha256:..."
}

LLM 只返回:

{
  "data": {},
  "evidence_index": {
    "/json/pointer": ["block_id"]
  },
  "field_status": {
    "/json/pointer": "verified"
  },
  "notes": []
}

运行

.\scripts\run_windows.ps1 `
  -InputPdf "C:\input\document.pdf" `
  -Schema "C:\input\fields.schema.json" `
  -OutputDir "C:\output\document" `
  -SkipLlm

或:

image-pdf-extract \
  --input /path/to/document.pdf \
  --schema /path/to/fields.schema.json \
  --output /path/to/output \
  --parser auto \
  --skip-llm

完成条件

  • 目标解析器实际可用,且 MinerU、Docling 的安装检查通过;
  • 处理页数与输入 PDF 一致;日志中 processed_pages == expected_pages,证据页码和 bbox 可回查原页;
  • 每个 verified 字段至少引用一个真实 block_id;
  • JSON Schema 校验通过,或明确列出失败项;
  • 未启用网络时,外部模型请求数为零;
  • 用户明确要求的交付物可打开且内容非空。

Current listing version

1.1.1

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value75/100

Highlights

  • 解决从图片型/扫描型 PDF 中提取结构化字段并溯源的实际需求
  • 适用于合同、报告、表单等需要自定义 Schema 和逐字段溯源的场景
Trigger Precision78/100

Areas to improve

  • description写错位置 Reported severity: Minor

    顶层 description 字段内容与 skill_body 内重复,且未在顶层 frontmatter 中单独列出

    Recommendation: 将 description 内容移至顶层 frontmatter 的 description 字段,避免重复

Highlights

  • 功能边界清晰,支持多种 PDF 类型和解析器
Structure and Standards88/100

Areas to improve

  • 缺少When to Use章节 Reported severity: Minor

    文档未明确说明典型使用场景和触发条件

    Recommendation: 增加 When to Use 章节,说明何时应使用此 Skill

Highlights

  • 文档结构完整,包含核心约束、输入、执行流程、证据格式等
  • 提供了清晰的运行示例和完成条件
Execution Reliability72/100

Areas to improve

  • 异常处理覆盖不全 Reported severity: Minor

    未覆盖网络请求失败、Schema 格式错误等常见异常场景

    Recommendation: 增加对网络请求、Schema 校验等关键步骤的异常处理说明

  • 依赖外部脚本和模型 Reported severity: Minor

    依赖 install_windows.ps1 和国内镜像说明等外部文件

    Recommendation: 确保所有引用文件完整,或在文档中提供备用方案

Highlights

  • 提及解析器安装、代理配置、内存故障处理等可靠性措施
  • 明确了完成条件和证据一致性检查
Evidence Verifiability (mean of the first four)78/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.