闲社服务运行正常AI智能体自动化平台
p

PDF文字提取

技能标识:pdf-ocr-extractor

Extract text from image-based or scanned PDFs using Tesseract OCR.

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.0.3
检测标记
后台标记通过
免费
免费获取
1
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

PDF文字提取

PDF OCR 提取器

使用此技能从扫描版PDF或基于图像的PDF中提取文本,这些PDF缺少原生文本层。该工具完全免费,不调用第三方API,且无使用次数限制。它会将PDF页面渲染为图像,并运行光学字符识别(OCR)。

依赖项

此技能需要:

  1. 1. 系统二进制文件:tesseract(以及所需的语言数据包,如chi_sim或eng)。
  2. Python包:pypdfium2、pytesseract和Pillow。

注意:运行时请勿自动执行pip install命令。依赖用户或环境预先安装元数据块中定义的依赖项。

快速开始

在临时目录中创建一个Python脚本(例如extract.py),以安全地处理提取操作:

python
import pypdfium2 as pdfium
import pytesseract
from PIL import Image
import sys
import os

def extract(pdf_path):
doc = pdfium.PdfDocument(pdf_path)
full_text = []
for i, page in enumerate(doc):
# 将页面渲染为高分辨率图像
bitmap = page.render(scale=2)
tmpimg = f/tmp/page{i}.png
bitmap.topil().save(tmpimg)

# 运行OCR(假设已安装英文和简体中文语言包)
text = pytesseract.imagetostring(Image.open(tmpimg), lang=chisim+eng)
full_text.append(text)

# 清理临时文件
os.remove(tmp_img)

return \n.join(full_text)

if name == main:
if len(sys.argv) > 1:
print(extract(sys.argv[1]))

然后执行脚本:
bash
python3 extract.py /path/to/document.pdf

安全与沙盒限制

  • - 仅将临时图像写入/tmp/目录,并在提取后立即清理。
  • 请勿尝试通过shell命令动态下载或安装语言包;如果缺少特定语言,请通知用户。

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 pdf-ocr-extraction-1776105248 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 pdf-ocr-extraction-1776105248 技能

通过命令行安装

skillhub install pdf-ocr-extraction-1776105248

下载

⬇ 下载 pdf-ocr-extractor v1.0.3(免费)

文件大小: 1.88 KB | 发布时间: 2026-4-17 15:43

v1.0.3 最新 2026-4-17 15:43
**Minor update for clarity and metadata improvements.**

- Improved documentation with clear separation of dependencies and quick start instructions.
- Added detailed metadata block defining required binaries and installation steps for both system and Python dependencies.
- Updated guidance to avoid running automated installations at runtime; users/environment must pre-install prerequisites.
- Enhanced security section: instructs storing temporary images only in `/tmp/` and immediate cleanup.
- Provided a full, copy-pasteable Python extraction script for better usability.
返回顶部