← 返回 Skills 市场
panpeter2024

PDF Reader

作者 Peter Pan · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ⚠ suspicious
126
总下载
1
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install pdf-reader
功能描述
Extract text from PDF files with automatic OCR fallback for scanned/image-based PDFs. Use when: (1) a user sends a PDF file and the framework did not auto-in...
使用说明 (SKILL.md)

PDF Reader

Extract text from any PDF — text-layer or scanned image.

How It Works

PDF received
  ├─ Has text layer? ──→ pdftotext (fast, high quality)
  │     └─ Text too sparse? ──→ Fall back to OCR
  └─ Detected as scan? ──→ Skip text, go straight to OCR
                               pdftoppm → tesseract

Quick Start

Run the bundled script via exec:

bash \x3Cskill-dir>/scripts/pdf-extract.sh /path/to/file.pdf

Save to file:

bash \x3Cskill-dir>/scripts/pdf-extract.sh /path/to/file.pdf --output /tmp/result.txt

Then read /tmp/result.txt with the read tool.

When This Skill Triggers

  1. User sends a PDF in chat but no \x3Cfile> text content was injected (only file path visible)
  2. Injected content is empty, garbled, or truncated
  3. User explicitly asks to read/extract/OCR a PDF file
  4. A PDF on disk needs text extraction for downstream processing

Typical Workflow

  1. Identify the PDF file path (usually /root/.openclaw/media/inbound/...)
  2. Run the extraction script
  3. Read the output and respond to the user

Example:

# Extract and save
bash \x3Cskill-dir>/scripts/pdf-extract.sh "/root/.openclaw/media/inbound/document.pdf" -o /tmp/pdf-text.txt

# Then use read tool on /tmp/pdf-text.txt

Script Options

Flag Description Default
--lang Tesseract languages (validated against allowlist) chi_sim+eng
--dpi Image resolution for OCR 300
--output / -o Save to file instead of stdout stdout
--ocr-only Force OCR, skip text extraction off
--text-only Text extraction only, no OCR fallback off
--auto-install Auto-install missing tools (poppler, tesseract) off

Dependencies

By default, the script does not install packages automatically. If tools are missing, it prints install instructions and exits.

To enable auto-install, pass --auto-install:

bash \x3Cskill-dir>/scripts/pdf-extract.sh file.pdf --auto-install

This installs poppler-utils and tesseract-ocr via apt-get, yum, or brew as needed.

Pre-install recommended (run once on the server):

apt-get install -y poppler-utils tesseract-ocr tesseract-ocr-chi-sim

Language Support

Default: Chinese Simplified + English (chi_sim+eng).

The --lang parameter is validated against a strict allowlist of official tesseract language codes. Invalid or malformed values are rejected.

Other languages:

# Japanese + English
bash \x3Cskill-dir>/scripts/pdf-extract.sh file.pdf --lang jpn+eng

# Korean
bash \x3Cskill-dir>/scripts/pdf-extract.sh file.pdf --lang kor

Tesseract language packs are auto-installed based on --lang.

Limitations

  • OCR quality depends on scan quality; low-resolution or handwritten PDFs may produce errors
  • Encrypted/password-protected PDFs are not supported
  • Large PDFs (50+ pages) may take 1-2 minutes for OCR
  • Pure-image pages (photos, diagrams without text) produce noise — this is expected
安全使用建议
This skill is reasonable for extracting text from PDFs. Before using it, be aware that it runs a local script, may install OCR/PDF utilities only if --auto-install is explicitly used, and can write output to a chosen path; keep PDF inputs and output files scoped to locations you trust.
功能分析
Type: OpenClaw Skill Name: pdf-reader Version: 1.1.0 The skill provides PDF text extraction and OCR capabilities via a bash script (scripts/pdf-extract.sh). It contains high-risk behaviors including the ability to install system packages using apt-get, yum, or brew (via the --auto-install flag) and a potential arbitrary file write vulnerability through the --output parameter. While the script implements some security measures like input validation for language codes and proper variable quoting, the combination of system-level modification capabilities and file system access aligns with the criteria for a suspicious classification.
能力评估
Purpose & Capability
The stated purpose is PDF text extraction with OCR fallback, and the bundled script implements that using pdftotext, pdfinfo, pdftoppm, and tesseract without unrelated credential use, network uploads, or hidden endpoints.
Instruction Scope
The instructions tell the agent to run a bundled shell script on a PDF path and optionally save output to a file. This is purpose-aligned, but the user should keep the input PDF and output path scoped to files they intend to process.
Install Mechanism
There is no install spec and the registry declares no required binaries, while the script depends on poppler/tesseract tools and can optionally install them through apt-get, yum, or brew when --auto-install is passed. The default behavior is to print install instructions and exit if tools are missing.
Credentials
OCR conversion creates temporary page images under /tmp and may consume CPU, memory, and disk for large PDFs, which is expected for OCR and the script includes cleanup for its temporary directory.
Persistence & Privilege
The skill does not define background persistence, credentials, or autonomous services. Persistent changes are limited to user-specified output files and optional system package installation if --auto-install is used.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install pdf-reader
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /pdf-reader 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.0
Security hardening: (1) Auto-install now requires explicit --auto-install flag, no longer runs package managers by default; (2) --lang parameter validated against strict allowlist, prevents injection attacks; (3) Language packages built in quoted array.
v1.0.0
Initial release: Universal PDF text extraction with automatic OCR fallback for scanned/image-based PDFs. Supports Chinese + English, auto-installs dependencies.
元数据
Slug pdf-reader
版本 1.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

PDF Reader 是什么?

Extract text from PDF files with automatic OCR fallback for scanned/image-based PDFs. Use when: (1) a user sends a PDF file and the framework did not auto-in... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 126 次。

如何安装 PDF Reader?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install pdf-reader」即可一键安装,无需额外配置。

PDF Reader 是免费的吗?

是的,PDF Reader 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

PDF Reader 支持哪些平台?

PDF Reader 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 PDF Reader?

由 Peter Pan(@panpeter2024)开发并维护,当前版本 v1.1.0。

💬 留言讨论