pdf-toolkit
FeaturedPDF 工具箱 - 合并/拆分/提取文字/转图片,纯命令行处理本地 PDF
Data & Documents 1,748 stars
417 forks Updated 4 days ago MIT
Install
Quality Score: 92/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# PDF 工具箱
帮用户对本地 PDF 文件做常见处理:合并、拆分、提取文字、转图片。优先用系统已有工具,
没有就用 Python 的 pypdf(轻量纯 Python,必要时 `pip install pypdf` 自动安装)。
## 能力概述
- **合并**:把多个 PDF 拼成一个
- **拆分**:按页拆成多份,或抽取指定页
- **提取文字**:把 PDF 内容导出成纯文本,便于总结/检索
- **页数/信息**:查看 PDF 总页数、元信息
## 操作方式
用 Bash 工具执行。下面以 pypdf 为例(跨平台、无需 Office/Acrobat):
```bash
# 确保依赖(仅首次,已装会秒过)
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(提示用户)
- 输出文件默认放在与源文件同目录,操作完告诉用户生成的文件名
Details
- Author
- dongsheng123132
- Repository
- dongsheng123132/u-claw
- Created
- 6 months ago
- Last Updated
- 4 days ago
- Language
- JavaScript
- License
- MIT
Similar Skills
Semantically similar based on skill content — not just same category
Data & Documents Listed
读取、提取、创建和修改 PDF,支持文本/表格/图片提取、合并、拆分、旋转、水印、表单、加密解密与 OCR。用户提到 PDF 文件或要求生成 PDF 时使用。
4 Updated 1 months ago
MrSGSA Data & Documents Listed
pdf-reader
通用 PDF 按需读取技能,适用于文字型、扫描/图片型、图文混排、大文件、加密、无书签或含表格/表单/链接的 PDF。先用 meta/toc/outline 建立全局地图,再按需抽取文本、渲染图片、搜索关键词或提取表格,避免全文加载并节省 tokens。
0 Updated 1 months ago
danking211367 Data & Documents Featured
Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.
231 Updated 6 days ago
peintune