Skip to content
Agentmart
Submit a tool

pdf-tools

PDF 文件处理 (Use when: 需要读取/合并/分割/转换 PDF,或从 PDF 提取文字/表格).

Skill by zzycxz

IndexedMIT★ 9
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/zzycxz-pdf-tools

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

PDF 文件处理 (Use when: 需要读取/合并/分割/转换 PDF,或从 PDF 提取文字/表格). NOT for: 网页内容抓取.

Use cases: documents

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/pdf-tools

What's inside

Skill name
pdf-tools
Description
PDF 文件处理 (Use when: 需要读取/合并/分割/转换 PDF,或从 PDF 提取文字/表格). NOT for: 网页内容抓取.
License
MIT
Instructions
126 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# PDF Tools — PDF 文件处理

本技能提供处理 PDF 文件的最佳实践。

## 场景 1:提取文字(优先使用宏工具)

当需要从 PDF 文件中读取和提取所有可读文本时,**必须优先调用 `pdf_op` 宏工具**:

```json
{
  "name": "pdf_op",
  "arguments": {
    "action": "read",
    "path": "C:\\path\\to\\document.pdf"
  }
}
```

如果需要更高级的自定义提取(按页处理、条件提取),可以使用 `pypdf` 库:

```python
from pypdf import PdfReader

pdf_path = r"C:\path\to\document.pdf"
reader = PdfReader(pdf_path)
for i, page in enumerate(reader.pages):
    text = page.extract_text()
    print(f"--- 第 {i+1} 页 ---")
    print(text)
```

## 场景 2:提取表格

```python
import pdfplumber
import pandas as pd

pdf_path = r"C:\path\to\report.pdf"
all_tables = []
with pdfplumber.open(pdf_path) as pdf:
    for page in pdf.pages:
        tables = page.extract_tables()
        for table in tables:
            df = pd.DataFrame(table[1:], columns=table[0])
            all_tables.append(df)

if all_tables:
    result = pd.concat(all_tables, ignore_index=True)
    output_path = r"C:\path\to\output.xlsx"
    result.to_excel(output_path, index=False)
    print(f"[RESULT_PATH: {output_path}]")
```

## 场景 3:合并多个 PDF

```python
from pypdf import PdfWriter, PdfReader as _R

merger_pages = []
for path in [
    r"C:\path\to\part1.pdf",
    r"C:\path\to\part2.pdf",
    r"C:\path\to\part3.pdf",
]:
    reader = _R(path)
    merger_pages.extend(reader.pages)

writer = PdfWriter()
for page in merger_pages:
    writer.add_page(page)

output_path = r"C:\path\to\merged.pdf"
with open(output_path, "wb") as f:
    writer.write(f)
print(f"[RESULT_PATH: {output_path}]")
```

## 场景 4:分割 PDF(按页范围)

```python
from pypdf import PdfReader, PdfWriter

reader = PdfReader(r"C:\path\to\original.pdf")
writer = PdfWriter()

# 提取第 3-7 页(索引 2-6)
for page_num in range(2, 7):
    writer.add_page(reader.pages[page_num])

output_path = r"C:\path\to\extracted_pages.pdf"
with open(output_path, "wb") as f:
    writer.write(f)
print(f"[RESULT_PATH: {output_path}]")
```

## 场景 5:生成新 PDF

```python
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont

output_path = r"C:\path\to\new_report.pdf"
c = canvas.Canvas(output_path, pagesize=A4)
width, height = A4

# 注册中文字体(需要字体文件)
# pdfmetrics.registerFont(TTFont("SimHei", "SimHei.ttf"))
# c.setFont("SimHei", 14)

c.setFont("Helvetica-Bold", 16)
c.drawString(50, height - 80, "Report Title")
c.setFont("Helvetica", 12)
c.drawString(50, height - 120, "Content goes here...")
c.save()
print(f"[RESULT_PATH: {output_path}]")
```

From zzycxz/rooster, MIT.

More from zzycxz/rooster

Signals

Stars
9
Forks
0
Open issues
0
Last commit (this folder)
Jun 9, 2026 (4 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from zzycxz

Cite this page

pdf-tools skill. Agent Mart. https://agentmart.dev/skills/zzycxz-pdf-tools (last updated 2026-10-24)