Agent Skillsdongsheng123132/u-claw › pdf-toolkit

pdf-toolkit

GitHub

提供本地PDF文件的合并、拆分、文字提取及页数查看等处理功能,通过Bash执行Python脚本实现,适用于文档整理与内容检索场景。

portable/skills-cn/pdf-toolkit/SKILL.md dongsheng123132/u-claw

Trigger Scenarios

用户需要合并多个PDF文件 用户需要从PDF中拆分或抽取特定页面 用户希望从PDF中提取纯文本内容 用户需要查看PDF的元信息或页数

Install

npx skills add dongsheng123132/u-claw --skill pdf-toolkit -g -y
More Options

Non-standard path

npx skills add https://github.com/dongsheng123132/u-claw/tree/main/portable/skills-cn/pdf-toolkit -g -y

Use without installing

npx skills use dongsheng123132/u-claw@pdf-toolkit

指定 Agent (Claude Code)

npx skills add dongsheng123132/u-claw --skill pdf-toolkit -a claude-code -g -y

安装 repo 全部 skill

npx skills add dongsheng123132/u-claw --all -g -y

预览 repo 内 skill

npx skills add dongsheng123132/u-claw --list

SKILL.md

Frontmatter
{
    "name": "pdf-toolkit",
    "metadata": {
        "openclaw": {
            "emoji": "📄"
        }
    },
    "description": "PDF 工具箱 - 合并\/拆分\/提取文字\/转图片,纯命令行处理本地 PDF"
}

PDF 工具箱

帮用户对本地 PDF 文件做常见处理:合并、拆分、提取文字、转图片。优先用系统已有工具, 没有就用 Python 的 pypdf(轻量纯 Python,必要时 pip install pypdf 自动安装)。

能力概述

  • 合并:把多个 PDF 拼成一个
  • 拆分:按页拆成多份,或抽取指定页
  • 提取文字:把 PDF 内容导出成纯文本,便于总结/检索
  • 页数/信息:查看 PDF 总页数、元信息

操作方式

用 Bash 工具执行。下面以 pypdf 为例(跨平台、无需 Office/Acrobat):

# 确保依赖(仅首次,已装会秒过)
python -c "import pypdf" 2>/dev/null || pip install -q pypdf

# 合并 a.pdf b.pdf -> merged.pdf
python - <<'PY'
from pypdf import PdfWriter
w = PdfWriter()
for f in ["a.pdf", "b.pdf"]:
    w.append(f)
w.write("merged.pdf"); w.close()
print("已合并 -> merged.pdf")
PY

# 提取全部文字
python - <<'PY'
from pypdf import PdfReader
r = PdfReader("input.pdf")
print("\n".join((p.extract_text() or "") for p in r.pages))
PY

# 抽取第 1-3 页 -> sub.pdf
python - <<'PY'
from pypdf import PdfReader, PdfWriter
r = PdfReader("input.pdf"); w = PdfWriter()
for i in range(0, 3):
    w.add_page(r.pages[i])
w.write("sub.pdf"); w.close()
print("已抽取 1-3 页 -> sub.pdf")
PY

使用建议

  • 处理前先 ls 确认文件存在、用 python -c "from pypdf import PdfReader;print(len(PdfReader('x.pdf').pages))" 看页数
  • 扫描件(图片型 PDF)提取不到文字属正常,需 OCR(提示用户)
  • 输出文件默认放在与源文件同目录,操作完告诉用户生成的文件名

Version History

  • 735e4de Current 2026-07-25 11:23

Same Skill Collection

portable/skills-cn/web-to-markdown/SKILL.md
portable/skills-cn/bilibili-helper/SKILL.md
portable/skills-cn/china-search/SKILL.md
portable/skills-cn/china-translate/SKILL.md
portable/skills-cn/china-weather/SKILL.md
portable/skills-cn/deepseek-helper/SKILL.md
portable/skills-cn/douyin-script/SKILL.md
portable/skills-cn/excel-helper/SKILL.md
portable/skills-cn/image-compress/SKILL.md
portable/skills-cn/ppt-designer/SKILL.md
portable/skills-cn/qrcode-maker/SKILL.md
portable/skills-cn/wechat-article/SKILL.md
portable/skills-cn/weibo-poster/SKILL.md
portable/skills-cn/word-writer/SKILL.md
portable/skills-cn/xiaohongshu-writer/SKILL.md
portable/skills-cn/zhihu-writer/SKILL.md

Metadata

Files
0
Version
50b2654
Hash
399ae303
Indexed
2026-07-25 11:23

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-29 21:38
浙ICP备14020137号-1 $Carte des visiteurs$