返回顶部
p

pdf-toolsPDF工具集

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
安全检测
已通过
3,715
下载量
免费
免费
2
收藏
概述
安装方式
版本历史

pdf-tools

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.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部