pdf-editor-compdf
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePDF Editor — PDF Document Processing CLI Tool
PDF Editor — PDF文档处理CLI工具
Platform Detection (Agent must execute automatically)
平台检测(Agent必须自动执行)
Before running any CLI command, the Agent must automatically detect the platform (read : →Windows, →Mac; or run ). Do NOT ask the user about their platform.
env.platformwin32darwinuname -s| Variable | [Windows] | [Mac] |
|---|---|---|
| | |
| | |
| | |
| | |
| | |
| Shell syntax | | |
= the absolute path of the directory containing this SKILL.md.{skill_root}
运行任何CLI命令前,Agent必须自动检测平台(读取:→Windows,→Mac;或执行)。请勿询问用户其使用的平台。
env.platformwin32darwinuname -s| 变量 | [Windows] | [Mac] |
|---|---|---|
| | |
| | |
| | |
| | |
| | |
| Shell语法 | | |
= 包含本SKILL.md文件的目录的绝对路径。{skill_root}
CLI Download & Installation (Required on first use)
CLI下载与安装(首次使用必填)
The CLI binary is not included in the Skill package. It is downloaded from the official ComPDFKit distribution server () operated by PDF Technologies, Inc. The Agent must complete the following steps before the first execution:
download.compdf.com- Check whether exists → skip if it does
<CLI> - Inform the user that the CLI binary will be downloaded from (official ComPDFKit CDN)
download.compdf.com - Download the appropriate archive for the platform:
- [Windows]:
https://download.compdf.com/skills/winCLI/win.zip - [Mac]:
https://download.compdf.com/skills/macCLI/mac.zip
- [Windows]:
- Extract the archive to the directory (the zip already contains a
{skill_root}/scripts/orwin/prefix, so the correct directory structure is formed automatically after extraction)mac/ - [Mac] After extraction, run:
chmod +x {skill_root}/scripts/mac/compdf_cli - Verify: run to confirm the binary is executable
<CLI> --help
Download is performed once on first use only; no re-download is needed on subsequent runs.
CLI二进制包未包含在Skill包中,需从PDF Technologies, Inc.运营的官方ComPDFKit分发服务器()下载。Agent必须在首次执行前完成以下步骤:
download.compdf.com- 检查是否存在 → 若存在则跳过
<CLI> - 告知用户将从(官方ComPDFKit CDN)下载CLI二进制包
download.compdf.com - 下载对应平台的压缩包:
- [Windows]:
https://download.compdf.com/skills/winCLI/win.zip - [Mac]:
https://download.compdf.com/skills/macCLI/mac.zip
- [Windows]:
- 将压缩包解压到目录(压缩包已包含
{skill_root}/scripts/或win/前缀,解压后会自动形成正确的目录结构)mac/ - [Mac] 解压后执行:
chmod +x {skill_root}/scripts/mac/compdf_cli - 验证:执行确认二进制包可正常运行
<CLI> --help
仅首次使用时需要下载;后续运行无需重新下载。
License Activation (Required on first use)
许可证激活(首次使用必填)
- Check whether exists → skip if it does
<LICENSE_PATH> - Ask the user for their email address (explain: the email is sent to the official ComPDFKit license server to obtain a free trial license; no other data is transmitted)
- After the user confirms, send , Body:
POST https://wms.compdf.com/api/license/skillsTrial<LICENSE_API_BODY>- : write the
code=200XML todata.license<LICENSE_PATH> - : prompt the user to retry with a different email address
code=500
- Run to verify activation
<CLI> --help
- 检查是否存在 → 若存在则跳过
<LICENSE_PATH> - 向用户索要电子邮箱地址(说明:该邮箱将发送至官方ComPDFKit许可证服务器以获取免费试用许可证;不会传输其他数据)
- 用户确认后,发送,请求体:
POST https://wms.compdf.com/api/license/skillsTrial<LICENSE_API_BODY>- :将
code=200的XML内容写入data.license<LICENSE_PATH> - :提示用户更换电子邮箱地址重试
code=500
- 执行验证激活状态
<CLI> --help
Common Options
通用选项
The following options apply to all commands (they are not repeated in individual command references):
| Option | Description | Default |
|---|---|---|
| Output file path or directory | Directory of the input file |
| Output filename | |
| Allow overwriting existing files | No |
以下选项适用于所有命令(不会在单个命令参考中重复列出):
| 选项 | 描述 | 默认值 |
|---|---|---|
| 输出文件路径或目录 | 输入文件所在目录 |
| 输出文件名 | |
| 允许覆盖已有文件 | 否 |
Command Reference
命令参考
split — Split PDF
split — 拆分PDF
<CLI> split <input.pdf> [options]| Option | Description | Default |
|---|---|---|
| `--mode <all | range>` | |
| Page range, e.g. | — |
Output naming: → ; →
all{original_filename}_page_{page_number}.pdfrange{original_filename}_pages_{start}-{end}.pdf<CLI> split <input.pdf> [options]| 选项 | 描述 | 默认值 |
|---|---|---|
| `--mode <all | range>` | |
| 页面范围,例如 | — |
输出命名规则: → ; →
all{original_filename}_page_{page_number}.pdfrange{original_filename}_pages_{start}-{end}.pdfmerge — Merge PDFs
merge — 合并PDF
<CLI> merge <file1.pdf> <file2.pdf> [file3.pdf ...] [options]Encrypted PDFs are skipped automatically; if fewer than 2 unencrypted files remain, the command fails.
<CLI> merge <file1.pdf> <file2.pdf> [file3.pdf ...] [options]加密PDF会被自动跳过;若剩余未加密文件不足2个,命令执行失败。
extract — Extract Pages
extract — 提取页面
<CLI> extract <input.pdf> --range <range> [options]| Option | Description |
|---|---|
| Required, e.g. |
<CLI> extract <input.pdf> --range <range> [options]| 选项 | 描述 |
|---|---|
| 必填,例如 |
rotate — Rotate Pages
rotate — 旋转页面
<CLI> rotate <input.pdf> --pages <range> --angle <90|180|270> [options]| Option | Description |
|---|---|
| Required, page range |
| `--angle <90 | 180 |
<CLI> rotate <input.pdf> --pages <range> --angle <90|180|270> [options]| 选项 | 描述 |
|---|---|
| 必填,页面范围 |
| `--angle <90 | 180 |
delete — Delete Pages
delete — 删除页面
<CLI> delete <input.pdf> --pages <range> [options]| Option | Description |
|---|---|
| Required, page range to delete |
<CLI> delete <input.pdf> --pages <range> [options]| 选项 | 描述 |
|---|---|
| 必填,待删除的页面范围 |
insert — Insert Pages/Images
insert — 插入页面/图片
<CLI> insert <target.pdf> --source <source.pdf> --pages <range> --at <position> [options]
<CLI> insert <target.pdf> --image <imagePath> --at <position> --width <width> --height <height> [options]| Option | Description |
|---|---|
| Source PDF (mutually exclusive with |
| Image path (mutually exclusive with |
| Page range from the source PDF; |
| Required, insert before page N (1-based) |
| Image page dimensions; |
<CLI> insert <target.pdf> --source <source.pdf> --pages <range> --at <position> [options]
<CLI> insert <target.pdf> --image <imagePath> --at <position> --width <width> --height <height> [options]| 选项 | 描述 |
|---|---|
| 源PDF(与 |
| 图片路径(与 |
| 源PDF中的页面范围;仅 |
| 必填,插入到第N页之前(从1开始计数) |
| 图片页面尺寸;仅 |
convert — Standard Format Conversion
convert — 标准格式转换
<CLI> convert <input.pdf> --standard <format> [options]| Option | Description | Default |
|---|---|---|
| Required: | — |
| ICC profile file | |
| PDF/UA title ( | Input filename |
| PDF/UA language ( | Win: |
--languageen-USzh-CNja-JPko-KRfr-FRde-DEenzhjakoExamples:
<CLI> convert "report.pdf" --standard pdfa-1a --overwrite
<CLI> convert "report.pdf" --standard pdfua-1 --title "My Document" --language zh-CN --overwrite<CLI> convert <input.pdf> --standard <format> [options]| 选项 | 描述 | 默认值 |
|---|---|---|
| 必填: | — |
| ICC配置文件 | |
| PDF/UA标题(仅 | 输入文件名 |
| PDF/UA语言(仅 | Windows: |
--languageen-USzh-CNja-JPko-KRfr-FRde-DEenzhjako示例:
<CLI> convert "report.pdf" --standard pdfa-1a --overwrite
<CLI> convert "report.pdf" --standard pdfua-1 --title "My Document" --language zh-CN --overwriteoptimize — Document Optimization & Compression
optimize — 文档优化与压缩
<CLI> optimize <input.pdf> [options]| Option | Description | Default |
|---|---|---|
| Enable image compression | No |
| Image quality | |
| Target image PPI | |
| Compression upper-limit PPI | Win |
| | |
| Fast Web View optimization | No |
| Page content optimization | No |
| Remove annotations | No |
| Remove bookmarks | No |
| Remove forms | No |
| Remove metadata | No |
| Remove document info | No |
| Incremental save mode | No |
Default behavior: removes unused/empty objects and enables Flate compression. Image compression is only enabled when or image-related parameters are explicitly passed.
--compress-imagesExamples:
<CLI> optimize "report.pdf" --overwrite
<CLI> optimize "report.pdf" --compress-images --image-quality 55 --target-ppi 144 --overwrite<CLI> optimize <input.pdf> [options]| 选项 | 描述 | 默认值 |
|---|---|---|
| 启用图片压缩 | 否 |
| 图片质量 | |
| 目标图片PPI | |
| 压缩上限PPI | Windows |
| | |
| 快速网页视图优化 | 否 |
| 页面内容优化 | 否 |
| 删除注释 | 否 |
| 删除书签 | 否 |
| 删除表单 | 否 |
| 删除元数据 | 否 |
| 删除文档信息 | 否 |
| 增量保存模式 | 否 |
默认行为:移除未使用/空对象并启用Flate压缩。仅当显式传入或图片相关参数时,才会启用图片压缩。
--compress-images示例:
<CLI> optimize "report.pdf" --overwrite
<CLI> optimize "report.pdf" --compress-images --image-quality 55 --target-ppi 144 --overwritecompare — Overlay Document Comparison
compare — 文档叠加对比
<CLI> compare <old.pdf> <new.pdf> [options]| Option | Description | Default |
|---|---|---|
| Page range | All pages |
| Stroke color | |
| Stroke opacity 0-1 | |
| Fill opacity 0-1 | |
| Hide fill | No |
| | |
<CLI> compare <old.pdf> <new.pdf> [options]| 选项 | 描述 | 默认值 |
|---|---|---|
| 页面范围 | 全部页面 |
| 线条颜色 | |
| 线条透明度 0-1 | |
| 填充透明度 0-1 | |
| 隐藏填充 | 否 |
| | |
watermark-text — Add Text Watermark
watermark-text — 添加文字水印
<CLI> watermark-text <input.pdf> --text <content> [options]<CLI> watermark-text <input.pdf> --text <content> [options]watermark-image — Add Image Watermark
watermark-image — 添加图片水印
<CLI> watermark-image <input.pdf> --image <image_path> [options]<CLI> watermark-image <input.pdf> --image <image_path> [options]Shared Watermark Options
水印通用选项
| Option | Description | [Win] Default | [Mac] Default |
|---|---|---|---|
| Watermark text (watermark-text only) | — | — |
| Image path (watermark-image only) | — | — |
| Page range to apply | All | All |
| Font (text only) | | |
| Font size (text only) | | |
| Text color (text only) | | |
| Opacity | | |
| Rotation angle | | |
| Scale factor | | |
| Alignment`left | center | right |
| Offset | | |
| Spacing | | |
| Foreground/background | Foreground | Foreground |
| Tiled/single | Tiled | Must be passed explicitly |
⚠️ Mac:is not enabled by default; tiled watermarks must be passed explicitly.--full-screen
Examples — [Windows]:
cmd
<CLI> watermark-text "report.pdf" --text "CONFIDENTIAL" --overwrite
<CLI> watermark-image "report.pdf" --image "logo.png" --scale 0.5 --opacity 100 --overwriteExamples — [Mac]:
bash
<CLI> watermark-text "report.pdf" --text "CONFIDENTIAL" --full-screen --overwrite
<CLI> watermark-image "report.pdf" --image "logo.png" --scale 0.5 --opacity 0.3 --full-screen --overwrite| 选项 | 描述 | [Windows] 默认值 | [Mac] 默认值 |
|---|---|---|---|
| 水印文字(仅watermark-text可用) | — | — |
| 图片路径(仅watermark-image可用) | — | — |
| 应用水印的页面范围 | 全部 | 全部 |
| 字体(仅文字水印可用) | | |
| 字体大小(仅文字水印可用) | | |
| 文字颜色(仅文字水印可用) | | |
| 透明度 | | |
| 旋转角度 | | |
| 缩放比例 | | |
| 对齐方式`left | center | right |
| 偏移量 | | |
| 间距 | | |
| 前景/背景 | 前景 | 前景 |
| 平铺/单个 | 平铺 | 必须显式传入 |
⚠️ Mac:默认未启用;如需平铺水印必须显式传入该参数。--full-screen
示例 — [Windows]:
cmd
<CLI> watermark-text "report.pdf" --text "CONFIDENTIAL" --overwrite
<CLI> watermark-image "report.pdf" --image "logo.png" --scale 0.5 --opacity 100 --overwrite示例 — [Mac]:
bash
<CLI> watermark-text "report.pdf" --text "CONFIDENTIAL" --full-screen --overwrite
<CLI> watermark-image "report.pdf" --image "logo.png" --scale 0.5 --opacity 0.3 --full-screen --overwritewatermark-delete — Remove All Watermarks
watermark-delete — 删除所有水印
<CLI> watermark-delete <input.pdf> [options][Win]removes all watermarks; [Mac] iterates and removes one by one. Selective removal is not supported.DeleteWatermarks()
<CLI> watermark-delete <input.pdf> [options][Windows]会移除所有水印;[Mac]会逐个迭代移除水印。不支持选择性删除。DeleteWatermarks()
Exit Codes
退出代码
| Code | Meaning | Action |
|---|---|---|
| Success | — |
| Parameter error | Check required parameters |
| File not found | Check path; wrap paths with spaces in double quotes |
| Runtime error | PDF processing failed or output directory is not writable |
| License failure | Missing → run activation; Expired → direct user tocontact sales |
| 代码 | 含义 | 操作 |
|---|---|---|
| 成功 | — |
| 参数错误 | 检查必填参数 |
| 文件未找到 | 检查路径;路径包含空格时请用双引号包裹 |
| 运行时错误 | PDF处理失败或输出目录不可写 |
| 许可证失败 | 缺失许可证 → 执行激活流程;已过期 → 引导用户前往联系销售 |
Usage Patterns (Agent quick reference)
使用模式(Agent快速参考)
| User says | Command |
|---|---|
| "Split into single pages" | |
| "Merge PDFs" | |
| "Extract pages X to Y" | |
| "Convert to PDF/A" | |
| "Compress PDF" | |
| "Compare two PDFs" | |
| "Add text watermark" | |
| "Add image watermark" | |
| "Remove watermark" | |
| "Rotate pages" | |
| "Delete page X" | |
| "Insert pages" | |
| "Insert image" | |
⚠️ Mac watermark commands requireto be passed explicitly (when tiling is desired).--full-screen
| 用户需求 | 命令 |
|---|---|
| "拆分为单页" | |
| "合并PDF" | |
| "提取第X到Y页" | |
| "转换为PDF/A" | |
| "压缩PDF" | |
| "对比两个PDF" | |
| "添加文字水印" | |
| "添加图片水印" | |
| "移除水印" | |
| "旋转页面" | |
| "删除第X页" | |
| "插入页面" | |
| "插入图片" | |
⚠️ Mac平台的水印命令如需平铺效果,必须显式传入参数。--full-screen
Limitations
限制
- Page ranges only support or
"N"; comma-separated values are not supported"N-M" - Except for (which skips encrypted files automatically), encrypted PDFs will cause an error and exit
merge - Wildcards, output path equal to input path, and multi-threaded parallel execution are not supported
- Results of standard format conversion and optimization depend on the content of the input PDF
- removes all watermarks; selective removal is not supported
watermark-delete - performs visual overlay comparison and does not output a structured diff list
compare
- 页面范围仅支持或
"N"格式;不支持逗号分隔的多个范围"N-M" - 除命令(会自动跳过加密文件)外,加密PDF会导致命令执行错误并退出
merge - 不支持通配符、输出路径与输入路径相同、多线程并行执行
- 标准格式转换和优化的结果取决于输入PDF的内容
- 会移除所有水印;不支持选择性删除
watermark-delete - 仅执行可视化叠加对比,不会输出结构化差异列表
compare
Troubleshooting
故障排查
| Issue | Resolution |
|---|---|
| Exit 4 / License error | |
| File not found | Check path; wrap paths containing spaces in double quotes |
| Page number out of range | First confirm the total page count of the PDF |
| Standard format conversion failed | Check font embedding and whether the ICC file matches the target standard |
| Optimize/compare/watermark failed | Confirm the input PDF can be opened and is not encrypted; check parameter format and output path permissions |
| 问题 | 解决方案 |
|---|---|
| 退出代码4 / 许可证错误 | |
| 文件未找到 | 检查路径;路径包含空格时请用双引号包裹 |
| 页码超出范围 | 先确认PDF的总页数 |
| 标准格式转换失败 | 检查字体嵌入情况以及ICC文件是否匹配目标标准 |
| 优化/对比/水印操作失败 | 确认输入PDF可正常打开且未加密;检查参数格式和输出路径权限 |
Security & Privacy
安全与隐私
All PDF processing is performed locally. No file content is uploaded.
| External Endpoint | Purpose | Data Sent | When | User Consent |
|---|---|---|---|---|
| Download CLI binary | None (HTTP GET) | First use only, if CLI not present | User is informed before download |
| SDK license activation | Email address only | First use only, if license not present | User provides email and confirms |
- Official Source: Both endpoints are operated by PDF Technologies, Inc. (a KDAN Company), the publisher of ComPDFKit SDK.
- No Telemetry: The CLI does not collect usage statistics, crash reports, or any anonymous data.
- No Network Dependency: After initial setup, all commands run fully offline without accessing any external services.
- License File: The /
license_key_windows.xmlgenerated after activation is stored only in the locallicense_key_mac.xmldirectory.scripts/
所有PDF处理均在本地完成。不会上传任何文件内容。
| 外部端点 | 用途 | 传输的数据 | 触发时机 | 用户许可要求 |
|---|---|---|---|---|
| 下载CLI二进制包 | 无(HTTP GET请求) | 首次使用且CLI未安装时 | 下载前会告知用户 |
| SDK许可证激活 | 仅电子邮箱地址 | 首次使用且许可证未激活时 | 用户提供邮箱并确认 |
- 官方来源:上述两个端点均由PDF Technologies, Inc.(KDAN旗下公司)运营,该公司是ComPDFKit SDK的发布方。
- 无遥测:CLI不会收集使用统计数据、崩溃报告或任何匿名数据。
- 无网络依赖:完成初始设置后,所有命令均可完全离线运行,无需访问任何外部服务。
- 许可证文件:激活后生成的/
license_key_windows.xml仅存储在本地license_key_mac.xml目录中。scripts/
Copyright & License
版权与许可证
This Skill is built on the ComPDFKit SDK. © 2014-2026 PDF Technologies, Inc., a KDAN Company. All Rights Reserved.
- License file: | Terms of Service: https://www.compdf.com/terms-of-service/?utm_source=clawhub&utm_medium=skillhub&utm_campaign=pdf_skill_pdf_editor&ref_platform_id=clawhub_skills
License.txt - Privacy Policy: https://www.compdf.com/privacy-policy/?utm_source=clawhub&utm_medium=skillhub&utm_campaign=pdf_skill_pdf_editor&ref_platform_id=clawhub_skills | Commercial Licensing: https://www.compdf.com/contact-sales/?utm_source=clawhub&utm_medium=skillhub&utm_campaign=pdf_skill_pdf_editor&ref_platform_id=clawhub_skills
本Skill基于ComPDFKit SDK构建。© 2014-2026 PDF Technologies, Inc.,KDAN旗下公司。保留所有权利。
- 许可证文件:| 服务条款:https://www.compdf.com/terms-of-service/?utm_source=clawhub&utm_medium=skillhub&utm_campaign=pdf_skill_pdf_editor&ref_platform_id=clawhub_skills
License.txt - 隐私政策:https://www.compdf.com/privacy-policy/?utm_source=clawhub&utm_medium=skillhub&utm_campaign=pdf_skill_pdf_editor&ref_platform_id=clawhub_skills | 商业许可:https://www.compdf.com/contact-sales/?utm_source=clawhub&utm_medium=skillhub&utm_campaign=pdf_skill_pdf_editor&ref_platform_id=clawhub_skills