一键导入
PDF 文件处理。用于读取、提取文本/表格/图片、合并、拆分、旋转、水印、加密/解密、表单填写、页面渲染。当用户提到 .pdf 文件或需要操作 PDF 时触发。
npx skills add https://github.com/ErixWong/touwaka-ai-mate --skill pdf复制此命令并粘贴到 Claude Code 中以安装该技能
PDF 文件处理。用于读取、提取文本/表格/图片、合并、拆分、旋转、水印、加密/解密、表单填写、页面渲染。当用户提到 .pdf 文件或需要操作 PDF 时触发。
npx skills add https://github.com/ErixWong/touwaka-ai-mate --skill pdf复制此命令并粘贴到 Claude Code 中以安装该技能
发票专用解析技能。支持中国增值税发票、普通发票、电子发票的结构化提取。基于 pdfjs-dist 实现坐标提取,可提取发票号码、日期、买卖双方信息、商品明细、金额等字段。
PDF 文件处理(Python 版)。使用 PyMuPDF 实现,内存效率高,适合处理大文件。用于读取、提取文本/表格/图片、合并、拆分、旋转、水印、加密/解密、页面渲染。当用户提到 .pdf 文件或需要操作 PDF 时触发。
Word 文档处理。用于读取、写入、编辑、模板填充 .docx 文件。支持页眉页脚、超链接、目录、图片操作。使用 Patcher API 保留原文档样式。当用户需要操作 Word 文档时触发。
ZIP file operations for creating and extracting archives.
ECharts 图表生成。用于需要可视化数据展示的场景,支持 20+ 图表类型(柱状图、折线图、饼图、雷达图等),输出 SVG/PNG/Base64/文件格式。当用户需要生成图表、数据可视化、统计图形时触发。
PowerPoint 演示文稿处理。用于读取现有 PPTX 信息、创建新演示文稿、提取媒体文件。支持文本、图片、表格、图表、形状、媒体、演讲者备注。当用户提到 .pptx 文件或需要操作 PowerPoint 时触发。
| name | |
| description | PDF 文件处理。用于读取、提取文本/表格/图片、合并、拆分、旋转、水印、加密/解密、表单填写、页面渲染。当用户提到 .pdf 文件或需要操作 PDF 时触发。 |
| license | Proprietary. LICENSE.txt has complete terms |
| argument-hint | [read|write] [operation] [path] |
| user-invocable | true |
依赖:pdf-lib (PDF 操作) + pdf-parse v2.4+ (文本/表格/图片提取、页面渲染)
本技能提供两个工具,通过 operation 参数区分具体操作:
| 工具 | 最终名称 | 说明 |
|---|---|---|
read | pdf__read | PDF 读取操作(不修改原文件) |
write | pdf__write | PDF 写入操作(创建或修改文件) |
通过 operation 参数区分具体读取操作:
| operation | 功能 | 关键参数 |
|---|---|---|
metadata | 读取元数据 | parse_page_info |
text | 提取文本 | from_page, to_page |
tables | 提取表格 | from_page, to_page |
images | 提取图片 | from_page, to_page, image_threshold |
render | 渲染页面为图片 | output_dir, scale, from_page, to_page |
markdown | 转 Markdown | output, from_page, to_page |
fields | 检查表单字段 | - |
field_info | 获取字段信息 | output |
通用参数:
path (string, required): PDF 文件路径operation (string, required): 操作类型from_page (number, optional): 起始页(从1开始)to_page (number, optional): 结束页(包含)suppress_warnings (boolean, optional): 抑制警告输出(默认: true)metadata 操作参数:
parse_page_info (boolean, optional): 解析每页详细信息(默认: false)images 操作参数:
image_threshold (number, optional): 图片最小尺寸阈值,像素(默认: 80)render 操作参数:
output_dir (string, optional): 输出目录(不指定则只返回 dataUrl)scale (number, optional): 缩放比例(默认: 1.5,相当于 150 DPI)desired_width (number, optional): 期望宽度(像素),设置后将忽略 scaleprefix (string, optional): 输出文件名前缀(默认: "page")markdown 操作参数:
output (string, optional): 输出 markdown 文件路径// 读取元数据
pdf__read({ path: "doc.pdf", operation: "metadata" })
// 提取第1-5页文本
pdf__read({ path: "doc.pdf", operation: "text", from_page: 1, to_page: 5 })
// 提取表格
pdf__read({ path: "doc.pdf", operation: "tables" })
// 提取图片
pdf__read({ path: "doc.pdf", operation: "images", image_threshold: 100 })
// 渲染页面为图片
pdf__read({ path: "doc.pdf", operation: "render", output_dir: "./images", scale: 1.5 })
// 转 Markdown
pdf__read({ path: "doc.pdf", operation: "markdown", output: "doc.md" })
// 检查表单字段
pdf__read({ path: "form.pdf", operation: "fields" })
// 获取字段信息
pdf__read({ path: "form.pdf", operation: "field_info", output: "fields.json" })
通过 operation 参数区分具体写入操作:
| operation | 功能 | 关键参数 |
|---|---|---|
create | 创建 PDF | content[], title, page_size |
merge | 合并 PDF | paths[] |
split | 拆分 PDF | output_dir, pages_per_file |
rotate | 旋转页面 | pages[], degrees |
encrypt | 加密 PDF | user_password, owner_password |
decrypt | 解密 PDF | password |
watermark | 添加水印 | watermark, is_text |
fill | 填写表单 | field_values |
通用参数:
path (string, required for most operations): PDF 文件路径output (string, required): 输出文件路径operation (string, required): 操作类型create 操作参数:
content (string[], required): 文本内容数组(每项为一页)title (string, optional): PDF 标题page_size (string, optional): 页面大小 - "letter" 或 "a4"(默认: "a4")merge 操作参数:
paths (string[], required): 要合并的 PDF 文件路径数组(至少2个)split 操作参数:
output_dir (string, required): 输出目录pages_per_file (number, optional): 每个文件的页数(默认: 1)prefix (string, optional): 输出文件名前缀(默认: "page")rotate 操作参数:
pages (number[], optional): 要旋转的页码(从1开始,为空则旋转所有)degrees (number, optional): 旋转角度 - 90, 180, 270(默认: 90)encrypt 操作参数:
user_password (string, required): 打开 PDF 的密码owner_password (string, optional): 编辑密码(默认使用 user_password)decrypt 操作参数:
password (string, required): 当前密码watermark 操作参数:
watermark (string, required): 水印文本或水印 PDF 路径is_text (boolean, optional): true 为文本水印,false 为 PDF 路径(默认: true)fill 操作参数:
field_values (object, required): 字段名和值的键值对// 创建 PDF
pdf__write({
output: "new.pdf",
operation: "create",
content: ["第一页内容", "第二页内容"],
title: "我的文档"
})
// 合并 PDF
pdf__write({
output: "merged.pdf",
operation: "merge",
paths: ["a.pdf", "b.pdf", "c.pdf"]
})
// 拆分 PDF(每文件1页)
pdf__write({
path: "doc.pdf",
output: "merged.pdf",
operation: "split",
output_dir: "./split",
pages_per_file: 1
})
// 旋转所有页面90度
pdf__write({
path: "doc.pdf",
output: "rotated.pdf",
operation: "rotate",
degrees: 90
})
// 旋转指定页面
pdf__write({
path: "doc.pdf",
output: "rotated.pdf",
operation: "rotate",
pages: [1, 3, 5],
degrees: 180
})
// 加密 PDF
pdf__write({
path: "doc.pdf",
output: "encrypted.pdf",
operation: "encrypt",
user_password: "secret123"
})
// 解密 PDF
pdf__write({
path: "encrypted.pdf",
output: "decrypted.pdf",
operation: "decrypt",
password: "secret123"
})
// 添加文本水印
pdf__write({
path: "doc.pdf",
output: "watermarked.pdf",
operation: "watermark",
watermark: "机密文件"
})
// 填写表单
pdf__write({
path: "form.pdf",
output: "filled.pdf",
operation: "fill",
field_values: {
name: "张三",
date: "2026-03-28",
approved: true
}
})
对于扫描版 PDF 或基于图片的 PDF,文本提取可能失败。使用 render 操作转换为图片,然后发送给 VL(视觉语言)模型进行文字识别。
工作流程:
read 工具的 render 操作将 PDF 页面转换为 PNG 图片示例:
pdf__read({ path: "scanned.pdf", operation: "render", output_dir: "./images", scale: 1.5 })
| 任务 | 工具 | operation |
|---|---|---|
| 读取元数据 | read | metadata |
| 提取文本 | read | text |
| 提取表格 | read | tables |
| 提取图片 | read | images |
| 渲染页面 | read | render |
| 转 Markdown | read | markdown |
| 检查表单字段 | read | fields |
| 获取字段信息 | read | field_info |
| 创建 PDF | write | create |
| 合并 PDF | write | merge |
| 拆分 PDF | write | split |
| 旋转页面 | write | rotate |
| 加密 PDF | write | encrypt |
| 解密 PDF | write | decrypt |
| 添加水印 | write | watermark |
| 填写表单 | write | fill |