PDF Crop
Documentspdf_cropPDF Crop is an Agent Skill for documents published in the cas-bigdatalab/piflow repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
裁剪PDF页面边距。通过指定边界坐标(left,bottom,right,top)来裁剪页面区域。当用户需要裁剪PDF页面时使用此skill。
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/cas-bigdatalab/piflow/blob/HEAD/workspace/skills/pdf_crop/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/pdf-crop, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
pdf_crop 技能
功能说明
该技能用于裁剪PDF页面边距,通过指定边界坐标(left, bottom, right, top)来精确裁剪页面区域,适用于去除PDF边距、提取特定区域等场景。
核心功能
- 支持精确的页面边界裁剪
- 可指定页码范围进行选择性裁剪
- 自动创建输出目录
使用方法
python scripts/run_pdf_crop.py --input_path <输入PDF> --output_path <输出PDF> --bbox <裁剪边界> [--pages <页码范围>]
参数说明
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| input_path | string | 是 | - | 输入PDF文件路径 |
| output_path | string | 是 | - | 输出PDF文件路径 |
| bbox | string | 是 | - | 裁剪边界"left,bottom,right,top"(PDF坐标单位) |
| pages | string | 否 | 全部 | 页码范围,如"1-3,5" |
示例
示例1:裁剪全部页面
python scripts/run_pdf_crop.py --input_path input.pdf --output_path cropped.pdf --bbox "50,50,550,750"
示例2:裁剪指定页码
python scripts/run_pdf_crop.py --input_path input.pdf --output_path cropped.pdf --bbox "50,50,550,750" --pages "1-10"
注意事项
- 裁剪边界使用PDF坐标系统(原点在左下角)
- 单位为点(1英寸=72点)
- 裁剪边界值应在页面尺寸范围内
- 输出目录不存在时会自动创建