PDF Compress — Claude Code skill: shrink PDFs
A skill that cuts PDF file size for email, web or archive, picking a compression preset and reporting what each step saved.
npx skills add claude-office-skills/skills --skill pdf-compress -a claude-codeWhat PDF Compress does
The skill runs through the office-mcp server and its compress_pdf tool. You name the goal — email attachment, under 5 MB, web viewing — and the agent picks a preset. Levels run from Minimum (archival, 5–15% saved) to Maximum (preview only, 70–90%).
Three things happen under the hood. Images are downsampled by DPI (72 for screen, 150 for digital documents, 300 for print) and converted to JPEG. Fonts get subset to the characters actually used, duplicates dropped. The file structure is cleaned: unused objects, metadata, optionally bookmarks and annotations. Vector text stays crisp at every level; only raster content degrades.
Batch mode takes a folder and returns a per-file summary. One caveat: stripping hidden layers, JavaScript and form fields cannot be undone, so leave those off if the PDF will still be filled in or edited. For print production and long-term archiving, stick to Minimum or Low.
What it helps with
- shrink a PDF to fit an email attachment limit
- resample images to 150 DPI for a digital document
- batch-compress a folder of reports and get a per-file summary
- strip metadata and unused objects before publishing
- build a lighter copy for web viewing
Example prompts for the agent
- Compress this PDF so it fits in an email
- Optimize this PDF for web viewing, quality is not critical
- Batch compress /documents/reports/ at medium level and show the report
How to install PDF Compress
1Skills CLI (Vercel)
npx skills add claude-office-skills/skills --skill pdf-compress -a claude-code2Manually: put the files in place
~/.claude/skills/pdf-compress/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/pdf-compress/
1Skills CLI (Vercel)
npx skills add claude-office-skills/skills --skill pdf-compress -a codex2Manually: put the files in place
.agents/skills/pdf-compress/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add claude-office-skills/skills --skill pdf-compress -a cursor2Manually: put the files in place
.cursor/skills/pdf-compress/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install claude-office-skills/skills pdf-compress2Manually: put the files in place
.github/skills/pdf-compress/SKILL.md1Skills CLI (Vercel)
npx skills add claude-office-skills/skills --skill pdf-compress -a gemini-cli2Platform CLI
gemini skills install https://github.com/claude-office-skills/skills --path pdf-compressManually: put the files in place
.devin/skills/pdf-compress/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add claude-office-skills/skills --skill pdf-compress -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about PDF Compress
How do I install PDF Compress in Claude?
Run npx skills add claude-office-skills/skills --skill pdf-compress -a claude-code. The skill lands in ~/.claude/skills/pdf-compress/SKILL.md.
What does PDF Compress do?
It reduces PDF size by downsampling images, recompressing them as JPEG, subsetting fonts and cleaning the file structure. Afterwards it reports how much each technique saved.
What does the skill need to run?
The office-mcp server with the compress_pdf tool. Without it the skill cannot start compression.
Source text
SKILL.md · MIT
---
# ═══════════════════════════════════════════════════════════════════════════════
# CLAUDE OFFICE SKILL - Enhanced Metadata v2.0
# ═══════════════════════════════════════════════════════════════════════════════
# Basic Information
name: PDF Compress
description: "Reduce PDF file size while maintaining acceptable quality"
version: "1.0"
author: claude-office-skills
license: MIT
# Categorization
category: pdf
tags:
- pdf
- compress
- optimize
- size
department: All
# AI Model Compatibility
models:
recommended:
- claude-sonnet-4
- claude-opus-4
compatible:
- claude-3-5-sonnet
- gpt-4
- gpt-4o
# MCP Tools Integration
mcp:
server: office-mcp
tools:
- compress_pdf
# Skill Capabilities
capabilities:
- file_compression
- optimization
# Language Support
languages:
- en
- zh
---
# PDF Compress
Reduce PDF file sizes for easier sharing, faster loading, and efficient storage.
## Overview
This skill helps you:
- Reduce PDF file sizes significantly
- Balance quality vs. file size
- Optimize for specific use cases (web, print, archive)
- Batch compress multiple files
- Understand compression trade-offs
## How to Use
### Basic Compression
```
"Compress this PDF to reduce file size"
"Make this PDF smaller for email"
"Optimize this PDF for web viewing"
```
### With Targets
```
"Compress this PDF to under 5 MB"
"Reduce file size by at least 50%"
"Optimize for minimum file size"
```
### Quality Levels
```
"Compress with high quality (minimal loss)"
"Compress for screen viewing"
"Maximum compression, quality not critical"
```
## Compression Levels
### Presets
| Level | Target Use | Image Quality | Size Reduction |
|-------|------------|---------------|----------------|
| **Minimum** | Archival | Original | 5-15% |
| **Low** | Print | Near original | 15-30% |
| **Medium** | General use | Good | 30-50% |
| **High** | Email/Web | Acceptable | 50-70% |
| **Maximum** | Preview only | Reduced | 70-90% |
### Use Case Recommendations
| Use Case | Recommended Level | Reason |
|----------|-------------------|--------|
| Print production | Minimum/Low | Quality critical |
| Email attachment | Medium/High | Balance size/quality |
| Web download | High | Fast loading |
| Quick preview | Maximum | Speed priority |
| Archive | Low | Long-term quality |
| Presentation | Medium | Good on-screen |
## Compression Techniques
### Image Optimization
```markdown
## 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 |
```
### Content Optimization
```markdown
## 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
```
## Output Report
### Compression Report
```markdown
## 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
```
### Optimization Plan
```markdown
## 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
### Batch Job Template
```markdown
## 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
### Before/After Guide
```markdown
## 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.
```
## Tool Recommendations
### Online Tools
- **SmallPDF**: Easy, good quality
- **ILovePDF**: Free, batch support
- **PDF24**: Configurable options
- **Adobe Online**: Professional quality
### Desktop Software
- **Adobe Acrobat Pro**: Best control
- **Foxit PDF Editor**: Good alternative
- **PDF-XChange**: Many options
- **Preview (Mac)**: Basic, built-in
### Command Line
- **Ghostscript**: Powerful, scriptable
- **qpdf**: Fast, lossless options
- **pdfcpu**: Modern Go tool
- **img2pdf**: Image-specific
## Limitations
- Cannot perform actual compression (provides guidance)
- Some PDFs have minimum compressible content
- Scanned documents are mostly images
- Already compressed PDFs have less savings
- Extreme compression affects quality
- Vector graphics don't compress much
© claude-office-skills · MIT · claude-office-skills/skills