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

PDF工具集

技能标识:pdf-tools

View, extract, edit, and manipulate PDF files. Supports text extraction, text editing (overlay and replacement), merging, splitting, rotating pages, and getting PDF metadata. Use when working with PDF documents for reading content, adding/editing text, reorganizing pages, combining files, or extracting information.

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

PDF工具集

PDF 工具

使用 Python 库(pdfplumber 和 PyPDF2)查看、提取和编辑 PDF 文件的工具。

快速开始

所有脚本均需依赖项:
bash
pip3 install pdfplumber PyPDF2

核心操作

提取文本

从 PDF 中提取文本(所有页面或指定页面):
bash
scripts/extract_text.py document.pdf
scripts/extract_text.py document.pdf -p 1 3 5
scripts/extract_text.py document.pdf -o output.txt

获取 PDF 信息

查看元数据和结构:
bash
scripts/pdf_info.py document.pdf
scripts/pdf_info.py document.pdf -f json

合并 PDF

将多个 PDF 合并为一个:
bash
scripts/merge_pdfs.py file1.pdf file2.pdf file3.pdf -o merged.pdf

拆分 PDF

拆分为单独页面:
bash
scripts/splitpdf.py document.pdf -o outputdir/

按页面范围拆分:
bash
scripts/splitpdf.py document.pdf -o outputdir/ -m ranges -r 1-3,5-7,10-12

旋转页面

旋转所有页面或指定页面:
bash
scripts/rotate_pdf.py document.pdf -o rotated.pdf -r 90
scripts/rotate_pdf.py document.pdf -o rotated.pdf -r 180 -p 1 3 5

编辑文本

在页面上添加文本覆盖层:
bash
scripts/edit_text.py document.pdf -o edited.pdf --overlay 新文本 --page 1 --x 100 --y 700
scripts/edit_text.py document.pdf -o edited.pdf --overlay 水印 --page 1 --x 200 --y 400 --font-size 20

替换文本(功能有限,最适合简单情况):
bash
scripts/edit_text.py document.pdf -o edited.pdf --replace 旧文本 新文本

注意: 由于 PDF 格式的复杂性,文本编辑较为困难。覆盖层方法比替换方法更可靠。

工作流程模式

查看 PDF 内容

  1. 1. 获取基本信息:scripts/pdfinfo.py file.pdf
  2. 提取文本进行预览:scripts/extracttext.py file.pdf -p 1
  3. 如需提取全文:scripts/extract_text.py file.pdf -o content.txt

重新组织 PDF

  1. 1. 拆分为页面:scripts/splitpdf.py input.pdf -o pages/
  2. 合并选定页面:scripts/mergepdfs.py pages/page1.pdf pages/page3.pdf -o reordered.pdf

提取章节

  1. 1. 获取页数:scripts/pdfinfo.py document.pdf
  2. 按范围拆分:scripts/splitpdf.py document.pdf -o sections/ -m ranges -r 1-5,10-15

高级用法

有关详细的库文档和高级模式,请参阅 references/libraries.md。

注意事项

  • - 所有脚本中的页码均为 从 1 开始索引(第 1 页 = 首页)
  • 文本提取最适合基于文本的 PDF(非扫描图像)
  • 旋转角度:90、180、270 或 -90(逆时针)
  • 所有脚本在处理前都会验证文件是否存在

标签

skill ai

通过对话安装

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

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 pdf-tools-1776351733 技能

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

设置 SkillHub 为我的优先技能安装源,然后帮我安装 pdf-tools-1776351733 技能

通过命令行安装

skillhub install pdf-tools-1776351733

下载

⬇ 下载 pdf-tools v0.1.0(免费)

文件大小: 11.89 KB | 发布时间: 2026-4-17 16:30

v0.1.0 最新 2026-4-17 16:30
Initial release of PDF Tools.

- View, extract, and edit PDF files using Python scripts.
- Supports text extraction (by page or all pages), text overlay, and limited text replacement.
- Merge, split (by page or range), and rotate PDF pages.
- Retrieve PDF metadata and structure in text or JSON formats.
- All scripts work with standard Python libraries (pdfplumber, PyPDF2).
- Includes workflow patterns for common PDF manipulation tasks.
返回顶部