Nested PDF Merger
This repository wraps the external nestedpdfmerger CLI.
Do not implement PDF merging logic in this repository.
Do not modify anything under reference/.
Requirements
This skill requires the nestedpdfmerger command to be installed and available on PATH.
Expected installation command:
CODEBLOCK0
Expected CLI entrypoint:
CODEBLOCK1
Alternative module invocation:
CODEBLOCK2
When to use
Use this skill when the user wants to:
- - Merge PDF files from a folder tree into one output PDF.
- Preserve the folder hierarchy as PDF bookmarks.
- Preview merge order with
--dry-run. - Exclude directories, change sort order, or disable bookmarks.
Workflow
- 1. Confirm the input directory and desired output path.
- Prefer
--dry-run first when the user wants to validate merge order. - Run the CLI with the smallest set of flags needed.
- If the command fails because the binary is missing, tell the user to install it with
pip install nestedpdfmerger.
Supported flags
- - INLINECODE7
- INLINECODE8
- INLINECODE9
- INLINECODE10
- INLINECODE11
- INLINECODE12
- INLINECODE13
- INLINECODE14
- INLINECODE15
- INLINECODE16
- INLINECODE17
Examples
Preview merge order:
CODEBLOCK3
Merge with explicit output:
CODEBLOCK4
Merge while excluding folders:
CODEBLOCK5
嵌套PDF合并器
本仓库封装了外部nestedpdfmerger命令行工具。
请勿在本仓库中实现PDF合并逻辑。
请勿修改reference/目录下的任何内容。
环境要求
本技能要求nestedpdfmerger命令已安装并可在PATH环境变量中访问。
预期安装命令:
bash
pip install nestedpdfmerger
预期CLI入口点:
bash
nestedpdfmerger INPUT_DIR -o OUTPUT.pdf [选项]
替代模块调用方式:
bash
python -m nestedpdfmerger INPUT_DIR -o OUTPUT.pdf [选项]
使用场景
当用户需要以下功能时使用本技能:
- - 将文件夹树中的PDF文件合并为一个输出PDF
- 保留文件夹层级结构作为PDF书签
- 使用--dry-run预览合并顺序
- 排除目录、更改排序顺序或禁用书签
工作流程
- 1. 确认输入目录和期望的输出路径
- 当用户需要验证合并顺序时,优先使用--dry-run参数
- 使用最少的必要参数运行CLI命令
- 如果命令因缺少二进制文件而失败,告知用户使用pip install nestedpdfmerger进行安装
支持的参数
- - -o, --output PATH(输出路径)
- --sort {natural,alpha,mtime}(排序方式)
- --reverse(反向排序)
- --exclude NAME [NAME ...](排除名称)
- --exclude-hidden(排除隐藏文件)
- --no-bookmarks(不生成书签)
- --dry-run(试运行)
- --strict(严格模式)
- --verbose(详细输出)
- --quiet(静默模式)
- --version(版本信息)
示例
预览合并顺序:
bash
nestedpdfmerger ./reports --dry-run
指定输出文件进行合并:
bash
nestedpdfmerger ./reports --output merged.pdf
合并时排除文件夹:
bash
nestedpdfmerger ./reports --output merged.pdf --exclude Backup Data