PDF Simple Tool Skill
This skill provides two main actions for working with PDF files:
- 1. splitpdf – Extract a page range from a PDF into a new PDF.
- pdfto_word – Convert a PDF into a simple Word (.docx) document.
Install
cd skills/pdf-simple-tool/node/
执行命令: npm install
Actions
split_pdf
When the user asks to split a PDF by page range (for example, "把这个 PDF 的第 3-5 页拆出来" / "split pages 3–5"), call the Node implementation:
- - Entry: INLINECODE0
- Function: INLINECODE1
Inputs
- -
inputPath (string): The absolute path to the source PDF. - INLINECODE3 (string): The absolute path where the new PDF will be written.
- INLINECODE4 (integer): Start page (1-based).
- INLINECODE5 (integer): End page (1-based, inclusive).
Example behavior:
- - If the user says: "帮我把 /Users/xingxing/.openclaw/workspace/test.pdf 的第 1-3 页拆成一个 PDF 文件",
map this to:
-
inputPath = "/Users/xingxing/.openclaw/workspace/test.pdf"
-
outputPath = "/Users/xingxing/.openclaw/workspace/test_p1-3.pdf"
-
fromPage = 1
- INLINECODE9
pdftoword
When the user asks to convert a PDF to Word (for example, "把这个 PDF 转成 Word" / "convert to docx"), call the Node implementation:
- - Entry: INLINECODE10
- Function: INLINECODE11
Inputs
- -
inputPath (string): The absolute path to the source PDF. - INLINECODE13 (string): The absolute path where the Word file (.docx) will be written.
Example behavior:
- - If the user says: "把 /Users/xingxing/.openclaw/workspace/test.pdf 转成 Word",
map this to:
-
inputPath = "/Users/xingxing/.openclaw/workspace/test.pdf"
- INLINECODE15
Notes
- - Implementation code lives in
skills/pdf-simple-tool/node/index.js and uses:
-
pdf-lib for PDF manipulation.
-
pdf-parse +
docx for PDF-to-Word conversion.
- - You are responsible for wiring these actions into your agent so that natural language
requests are converted into the appropriate function calls with the correct paths and page ranges.
PDF 简易工具技能
该技能提供了两个用于处理PDF文件的主要操作:
- 1. splitpdf – 从PDF中提取指定页面范围并生成新的PDF文件。
- pdfto_word – 将PDF转换为简单的Word (.docx) 文档。
安装
cd skills/pdf-simple-tool/node/
执行命令: npm install
操作
split_pdf
当用户要求按页面范围拆分PDF时(例如,把这个 PDF 的第 3-5 页拆出来 / split pages 3–5),调用Node实现:
- - 入口:skills/pdf-simple-tool/node/index.js
- 函数:splitPdf(inputPath, outputPath, fromPage, toPage)
输入参数
- - inputPath (字符串):源PDF文件的绝对路径。
- outputPath (字符串):新PDF文件将要写入的绝对路径。
- fromPage (整数):起始页(从1开始计数)。
- toPage (整数):结束页(从1开始计数,包含该页)。
示例行为:
- - 如果用户说:帮我把 /Users/xingxing/.openclaw/workspace/test.pdf 的第 1-3 页拆成一个 PDF 文件,
映射为:
- inputPath = /Users/xingxing/.openclaw/workspace/test.pdf
- outputPath = /Users/xingxing/.openclaw/workspace/test_p1-3.pdf
- fromPage = 1
- toPage = 3
pdftoword
当用户要求将PDF转换为Word时(例如,把这个 PDF 转成 Word / convert to docx),调用Node实现:
- - 入口:skills/pdf-simple-tool/node/index.js
- 函数:pdfToWord(inputPath, outputPath)
输入参数
- - inputPath (字符串):源PDF文件的绝对路径。
- outputPath (字符串):Word文件 (.docx) 将要写入的绝对路径。
示例行为:
- - 如果用户说:把 /Users/xingxing/.openclaw/workspace/test.pdf 转成 Word,
映射为:
- inputPath = /Users/xingxing/.openclaw/workspace/test.pdf
- outputPath = /Users/xingxing/.openclaw/workspace/test.docx
注意事项
- - 实现代码位于 skills/pdf-simple-tool/node/index.js 中,并使用:
- pdf-lib 进行PDF操作。
- pdf-parse + docx 进行PDF到Word的转换。
- - 您需要将这些操作接入您的智能体,以便将自然语言请求转换为带有正确路径和页面范围的相应函数调用。