关于 PDF Compress
PDF Compress 是面向需要缩小 PDF 文件的指导型 Skill,可协助设定压缩目标并权衡画质与体积,但不会实际压缩文件。
主要功能
- 01压缩级别指导
- 02画质与体积权衡
- 03按用途提供建议
- 04批量任务规划
- 05压缩报告
适用场景
- 01准备适合邮件发送的 PDF
- 02优化网页浏览用文档
- 03规划批量压缩任务
- 04选择打印或归档设置
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ claude-office-skills/ skills --skill pdf-compress安装后在 Claude Code 中输入/pdf-compress确认已加载。
详细介绍
PDF 压缩
减小 PDF 文件大小,便于分享、加快加载速度并高效存储。
概述
此技能可帮助你:
- 显著减小 PDF 文件大小
- 平衡质量与文件大小
- 针对特定用途(网页、打印、存档)进行优化
- 批量压缩多个文件
- 了解压缩的取舍
使用方法
基本压缩
"Compress this PDF to reduce file size"
"Make this PDF smaller for email"
"Optimize this PDF for web viewing"
设置目标
"Compress this PDF to under 5 MB"
"Reduce file size by at least 50%"
"Optimize for minimum file size"
质量级别
"Compress with high quality (minimal loss)"
"Compress for screen viewing"
"Maximum compression, quality not critical"
压缩级别
预设
| 级别 | 适用场景 | 图像质量 | 减小幅度 |
|---|---|---|---|
| 最低 | 存档 | 原始 | 5-15% |
| 低 | 打印 | 接近原始 | 15-30% |
| 中 | 常规用途 | 良好 | 30-50% |
| 高 | 电子邮件/网页 | 可接受 | 50-70% |
| 最高 | 仅供预览 | 降低 | 70-90% |
使用场景建议
| 使用场景 | 建议级别 | 原因 |
|---|---|---|
| 印刷制作 | 最低/低 | 质量至关重要 |
| 电子邮件附件 | 中/高 | 平衡大小与质量 |
| 网页下载 | 高 | 加载速度快 |
| 快速预览 | 最高 | 优先考虑速度 |
| 存档 | 低 | 长期保持质量 |
| 演示文稿 | 中 | 屏幕显示效果良好 |
压缩技术
图像优化
## Image Compression Settings
### Resolution Reduction
| Target | DPI | Use For |
|--------|-----|---------|
| Screen | 72 | Web viewing |
| eBook | 150 | Digital documents |
| Print-basic | 200 | Office printing |
| Print-quality | 300 | Professional print |
| Original | N/A | No reduction |
### Format Conversion
| From | To | Savings | Quality Impact |
|------|-----|---------|----------------|
| TIFF | JPEG | 70-90% | Some loss |
| PNG | JPEG | 50-80% | Some loss |
| BMP | JPEG | 90%+ | Some loss |
| JPEG | JPEG (recompress) | 20-50% | Cumulative loss |
### Quality Levels
| Setting | JPEG Quality | Visual Impact |
|---------|--------------|---------------|
| Maximum | 90-100 | Imperceptible |
| High | 75-89 | Minimal |
| Medium | 50-74 | Noticeable on zoom |
| Low | 25-49 | Visible artifacts |
内容优化
## Additional Optimizations
### Font Optimization
- [ ] Subset fonts (remove unused characters)
- [ ] Convert to standard fonts where possible
- [ ] Remove duplicate font instances
### Structure Optimization
- [ ] Remove unused objects
- [ ] Clean up metadata
- [ ] Linearize for web (fast web view)
- [ ] Remove bookmarks (optional)
- [ ] Remove comments/annotations (optional)
### Content Removal (Caution)
- [ ] Remove hidden layers
- [ ] Remove JavaScript
- [ ] Remove form fields
- [ ] Remove embedded files
输出报告
压缩报告
## PDF Compression Report
### File Summary
| Metric | Before | After | Change |
|--------|--------|-------|--------|
| **File Size** | 45.2 MB | 8.7 MB | -81% |
| **Pages** | 120 | 120 | - |
| **Images** | 89 | 89 | - |
### Compression Applied
| Technique | Savings |
|-----------|---------|
| Image downsampling (150 DPI) | 28.5 MB |
| JPEG compression (75%) | 5.2 MB |
| Font subsetting | 1.8 MB |
| Object cleanup | 1.0 MB |
| **Total Savings** | **36.5 MB (81%)** |
### Quality Assessment
| Aspect | Rating | Notes |
|--------|--------|-------|
| Text clarity | ⭐⭐⭐⭐⭐ | No change |
| Image sharpness | ⭐⭐⭐⭐ | Slight softening |
| Color accuracy | ⭐⭐⭐⭐⭐ | Preserved |
| Zoom quality | ⭐⭐⭐ | Pixelation at 400%+ |
### Recommendations
✅ Suitable for: Email, web, screen viewing
⚠️ Not recommended for: High-quality print, archival
优化方案
## Compression Strategy: [Document Name]
### Current State
- File size: 150 MB
- Pages: 200
- Issue: Too large for email (limit: 25 MB)
### Target
- Max size: 20 MB
- Maintain readability
### Recommended Approach
1. **Images**: Reduce to 150 DPI, JPEG 70%
- Expected savings: ~100 MB
2. **Fonts**: Subset embedded fonts
- Expected savings: ~5 MB
3. **Cleanup**: Remove metadata, optimize structure
- Expected savings: ~5 MB
### Expected Result
- Final size: ~20 MB
- Quality: Good for screen/general use
批量压缩
批处理作业模板
## Batch Compression Job
### Input
- **Folder**: /documents/reports/
- **Files**: 45 PDFs
- **Total Size**: 2.3 GB
### Settings
- Compression level: Medium
- Target: Email-friendly (<10 MB each)
- Image DPI: 150
- JPEG quality: 75%
### Progress
| File | Original | Compressed | Reduction |
|------|----------|------------|-----------|
| report_q1.pdf | 85 MB | 12 MB | 86% |
| report_q2.pdf | 120 MB | 18 MB | 85% |
| report_q3.pdf | 95 MB | 14 MB | 85% |
| ... | ... | ... | ... |
### Summary
| Metric | Value |
|--------|-------|
| Files processed | 45 |
| Total before | 2.3 GB |
| Total after | 380 MB |
| Average reduction | 83% |
| Files under 10 MB | 42/45 |
### Large Files (Need Review)
| File | Size | Recommendation |
|------|------|----------------|
| annual_photos.pdf | 25 MB | Split or higher compression |
| tech_diagrams.pdf | 18 MB | Reduce image count |
| charts_hires.pdf | 15 MB | Acceptable |
质量对比
压缩前后指南
## Quality Comparison Guide
### Image Quality at Different Levels
**Original (300 DPI, no compression)**
- Sharp at all zoom levels
- File size: Large
**High Quality (200 DPI, JPEG 85%)**
- Sharp at 100-200% zoom
- Minor softening at high zoom
- File size: Medium-large
**Medium Quality (150 DPI, JPEG 70%)**
- Good at 100% zoom
- Noticeable softening at 200%+
- File size: Medium
**Low Quality (96 DPI, JPEG 50%)**
- Acceptable at 100%
- Pixelation visible
- File size: Small
### Text Remains Sharp
Note: Text (when vector) remains crisp at all compression levels.
Only embedded text images are affected.
工具推荐
在线工具
- SmallPDF:操作简单,质量良好
- ILovePDF:免费,支持批量处理
- PDF24:可配置选项
- Adobe Online:专业级质量
桌面软件
- Adobe Acrobat Pro:控制能力最佳
- Foxit PDF Editor:不错的替代方案
- PDF-XChange:选项丰富
- Preview (Mac):基础功能,内置应用
命令行
- Ghostscript:功能强大,可编写脚本
- qpdf:速度快,提供无损选项
- pdfcpu:现代 Go 工具
- img2pdf:专用于图像
限制
- 无法实际执行压缩(仅提供指导)
- 有些 PDF 可压缩内容有限
- 扫描文档大多由图像组成
- 已压缩的 PDF 可节省空间较少
- 过度压缩会影响质量
- 矢量图形的压缩幅度不大
评论
支持 Markdown