Token导航 LogoToken导航TokenDH.com
前端设计只读github未标认证来源可访问许可证需确认审计通过

pdf-extractorPDF extractor 搜索

Agent Skill

pdf-extractor 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

533

周安装

22

GitHub Stars

9

下载量

174
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:pdf-extractor(PDF extractor 搜索)
来源仓库:https://github.com/ahundt/autorun
仓库路径:skills/pdf-extractor
安装命令:
npx skills add https://github.com/ahundt/autorun --skill pdf-extractor
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/ahundt/autorun --skill pdf-extractor

简介

pdf-extractor 实现 PDF 文档文本与结构化数据提取,支持多后端 fallback。

  • 自动检测 GPU 加速环境,优化大文件处理性能。
  • 输出为 Markdown 格式,便于后续文本分析与知识整合。
  • 适用于合同解析、报告摘要与文档归档等离线处理任务。
  • 支持单文件与批量提取模式,灵活适配不同工作流需求。

SKILL.md

PDF Data Extraction

Extract text and structured data from PDF documents using a multi-backend approach with automatic fallback.

Overview

This skill provides PDF text extraction with 9 different backends, automatic GPU detection, and intelligent backend selection. The extraction system tries backends in order until one succeeds, producing markdown output optimized for further processing.

Quick Start Workflow

To extract text from PDFs:

  1. Single file extraction (installed CLI - recommended): extract-pdfs /path/to/document.pdf Output: Creates document.md in the same directory.
  2. Batch extraction (directory): extract-pdfs /path/to/pdfs/ /path/to/output/ Output: Creates .md files for all PDFs in output directory.
  3. Custom output file: extract-pdfs document.pdf output.md
  4. Specific backends: extract-pdfs document.pdf --backends markitdown pdfplumber
  5. List available backends: extract-pdfs --list-backends Output: Shows available backends and GPU status.

Alternative Execution Methods

If the extract-pdfs CLI isn't installed, install it first (recommended):

# Install as global UV tool (from repo root):
cd "${CLAUDE_PLUGIN_ROOT}/../.." && uv tool install --force --editable plugins/pdf-extractor
extract-pdfs --list-backends  # verify

Or use these fallback methods without installing:

# uv run (recommended fallback — no install required):
uv run --project "${CLAUDE_PLUGIN_ROOT}" python -m pdf_extraction document.pdf

# Standalone script execution
python "${CLAUDE_PLUGIN_ROOT}/src/pdf_extraction/cli.py" document.pdf

Backend Selection Guide

Custom Backend Ordering

Specify backends in any order with --backends. The system tries each in order, stopping on first success:

# Tables first, then general extraction
extract-pdfs document.pdf --backends pdfplumber markitdown pdfminer

# Scanned documents: vision-based first
extract-pdfs scanned.pdf --backends marker docling markitdown

# Most permissive fallback order (handles problematic PDFs)
extract-pdfs document.pdf --backends pdfminer pypdf2 markitdown

# Single backend only (no fallback)
extract-pdfs document.pdf --backends markitdown

CPU-Only Systems (Default)

For systems without GPU, the recommended backend order:

  • markitdown - Microsoft's lightweight converter (MIT, fast, no models)
  • pdfplumber - Excellent for tables (MIT)
  • pdfminer - Pure Python, reliable (MIT)
  • pypdf2 - Basic extraction, always available (BSD-3)

GPU Systems

For systems with CUDA-enabled GPU:

  • docling - IBM layout analysis (MIT, ~500MB models)
  • marker - Vision-based, best for scanned docs (GPL-3.0, ~1GB models)
  • Plus all CPU backends as fallback

Backend Comparison

BackendLicenseModelsBest ForSpeed
markitdownMITNoneGeneral text, formsFast
pdfplumberMITNoneTables, structured dataFast
pdfminerMITNoneSimple text documentsFast
pypdf2BSD-3NoneBasic extractionFast
doclingMIT~500MBLayout analysisMedium
markerGPL-3.0~1GBScanned documentsSlow
pymupdf4llmAGPL-3.0NoneLLM-optimized outputFast
pdfboxApache-2.0NoneTables (Java-based)Medium
pdftotextSystemNoneSimple text (CLI)Fast

Backend Decision Matrix

Document TypeRecommended Backend(s)Why
Digital text PDF (default)markitdown, pdfplumberFast, accurate
PDF with tables/invoicespdfplumber, pdfboxBest table structure
Complex layouts/columnsdocling (GPU)Layout analysis
Scanned documents/imagesmarker, docling (GPU)OCR/vision required
Insurance policies/formsmarkitdown, pdfplumberHandles form fields
Academic papersdoclingEquations, figures
Maximum compatibilitypdfminer, pypdf2Fewest dependencies
Commercial use requiredmarkitdown, pdfplumberMIT license

Programmatic Usage

To use the extraction library directly in Python code:

from pdf_extraction import extract_single_pdf, pdf_to_txt, detect_gpu_availability

# Check available backends
gpu_info = detect_gpu_availability()
print(f"Recommended backends: {gpu_info['recommended_backends']}")

# Extract single file
result = extract_single_pdf(
    input_file='/path/to/document.pdf',
    output_file='/path/to/output.md',
    backends=['markitdown', 'pdfplumber']
)

if result['success']:
    print(f"Extracted with {result['backend_used']}")
    print(f"Quality metrics: {result['quality_metrics']}")

# Batch extract directory
output_files, metadata = pdf_to_txt(
    input_dir='/path/to/pdfs/',
    output_dir='/path/to/output/',
    resume=True,  # Skip already-extracted files
    return_metadata=True
)

Extraction Metadata

Every extraction returns metadata for quality assessment:

{
    'success': True,
    'backend_used': 'markitdown',
    'extraction_time_seconds': 2.5,
    'output_size_bytes': 15234,
    'quality_metrics': {
        'char_count': 15234,
        'line_count': 450,
        'word_count': 2800,
        'table_markers': 12,      # Count of | (tables)
        'has_structure': True     # Has markdown structure
    },
    'encrypted': False,
    'error': None
}

Handling Common Scenarios

Encrypted PDFs

The system detects encrypted PDFs and reports them:

if result['encrypted']:
    print("PDF is password-protected")

Encrypted PDFs cannot be extracted without the password.

Empty or Failed Extractions

When all backends fail:

  1. Check if PDF is encrypted
  2. Try with --backends pdfminer pypdf2 (most permissive)
  3. Check PDF isn't corrupted
  4. Consider OCR-based backends for scanned documents

Resume Batch Processing

To continue interrupted batch extraction:

extract-pdfs /path/to/pdfs/ /path/to/output/

The resume=True default skips already-extracted files.

To force re-extraction:

extract-pdfs /path/to/pdfs/ --no-resume

Tables and Structured Data

For PDFs with tables, prioritize:

extract-pdfs document.pdf --backends pdfplumber markitdown

The output will contain markdown tables when detected:

| Column1 | Column2 | Column3 |
|---------|---------|---------|
| Data    | Data    | Data    |

Module Structure Reference

Source Code Layout

Location: ${CLAUDE_PLUGIN_ROOT}/src/pdf_extraction/

FilePurpose
__init__.pyPackage exports (extract_single_pdf, pdf_to_txt, etc.)
__main__.pySupport for python -m pdf_extraction
cli.pyCLI entry point with argparse
backends.pyBackendExtractor base class + 9 backend implementations
extractors.pyextract_single_pdf(), pdf_to_txt() functions
utils.pyGPU detection, quality metrics, encryption check

Key Classes and Functions

ComponentLocationPurpose
BackendExtractorbackends.py:35-123Base class with Template Method pattern
DoclingExtractorbackends.py:130-142IBM Docling backend (MIT, GPU)
MarkerExtractorbackends.py:145-158Vision-based marker backend (GPL-3.0, GPU)
MarkItDownExtractorbackends.py:161-173Microsoft MarkItDown (MIT, CPU)
PdfplumberExtractorbackends.py:244-253Table-focused extraction (MIT)
PdfminerExtractorbackends.py:219-226Pure Python fallback (MIT)
Pypdf2Extractorbackends.py:229-241Basic extraction, always available (BSD-3)
BACKEND_REGISTRYbackends.py:279-292Dict mapping backend names to factories
detect_gpu_availability()utils.py:9-40Auto-detect GPU and recommend backends
extract_single_pdf()extractors.py:13-80Extract one PDF with backend fallback
pdf_to_txt()extractors.py:83-170Batch extract directory with resume

Key implementation details:

  • Backend fallback loop: extractors.py:55-78 - Tries each backend in order, stops on first success
  • Lazy initialization: backends.py:77-79 - Converters created only when first used
  • Quality metrics: utils.py:43-76 - Calculates char/word/table counts

Additional Resources

Reference Files

For detailed backend documentation and advanced patterns:

  • references/backends.md - Detailed backend comparison and selection guide

Example Usage

Working examples in the insurance analysis that prompted this skill:

  • Extracted 21 PDFs from mortgage statements and insurance policies
  • Used markitdown backend for fast extraction
  • Parsed structured data (dates, amounts, policy numbers)

Error Handling

The extraction system handles errors gracefully:

  1. Backend failures: Automatically tries next backend
  2. Import errors: Skips unavailable backends
  3. File errors: Reports specific error message
  4. Partial success: Continues with remaining files in batch

All errors are captured in metadata rather than raising exceptions.

Dependencies

Core dependencies (always available):

  • pdfminer.six - Pure Python PDF parser
  • pdfplumber - Table-aware extraction
  • PyPDF2 - Basic PDF operations
  • tqdm - Progress bars

Optional dependencies:

  • markitdown - Microsoft multi-format converter
  • docling - IBM document processor (GPU-accelerated)
  • marker-pdf - Vision-based extraction (GPU-accelerated)
  • pymupdf4llm - LLM-optimized output
  • pdfbox - Java-based extraction

Install all dependencies:

uv pip install "markitdown>=0.1.0" "pdfplumber>=0.10.0" "pdfminer.six>=20221105" "PyPDF2>=3.0.0" tqdm

For GPU backends:

uv pip install docling marker-pdf

Troubleshooting

extract-pdfs: command not found

# Install as global UV tool from repo root:
cd plugins/pdf-extractor && uv tool install --force --editable . && cd ../..
extract-pdfs --list-backends  # verify

ModuleNotFoundError: No module named 'pdf_extraction' (or 'markitdown', 'pdfplumber')

# Re-install with all base dependencies:
cd plugins/pdf-extractor && uv tool install --force --editable . && cd ../..
# Or install explicitly:
uv pip install "markitdown>=0.1.0" "pdfplumber>=0.10.0" "pdfminer.six>=20221105" "PyPDF2>=3.0.0" tqdm

GPU backends (docling, marker) not available

# Requires PyTorch; install GPU extras:
cd plugins/pdf-extractor && uv tool install --force --editable ".[gpu]" && cd ../..
extract-pdfs --list-backends  # verify gpu backends appear
# Note: docling downloads ~500MB models on first use; marker downloads ~1GB

Empty output from scanned PDF (image-only document)

# Scanned PDFs require OCR (GPU backends):
extract-pdfs scanned.pdf --backends marker docling
# If GPU unavailable, try pdftotext (system tool):
brew install poppler        # macOS
# apt install poppler-utils  # Ubuntu/Debian
extract-pdfs scanned.pdf --backends pdftotext

pdfminer import error (package name confusion)

# Install correct package (name has .six suffix):
uv pip install "pdfminer.six>=20221105"
# Import is still: from pdfminer.high_level import extract_text  (no .six)

markitdown version conflict

# API changed significantly in 0.1.0; ensure correct version:
uv pip install "markitdown>=0.1.0"

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

32.9%
按下载量换算57

Claude

29.83%
按下载量换算52

Cursor

19.5%
按下载量换算34

Gemini CLI

9.03%
按下载量换算16

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills