A Raycast script command for compressing PDF files using Ghostscript with PDF Squeezer-like quality settings.
- Three compression levels - Low, Medium, High
- Batch processing - Compress multiple PDFs at once
- Smart detection - Skips files that can't be compressed further
- Size feedback - Shows total space saved after compression
| Level | DPI | Best For |
|---|---|---|
| Low | 72 | Web, email attachments |
| Medium | 150 | General use (default) |
| High | 300 | Printing |
- macOS
- Raycast
- Ghostscript
brew install ghostscriptCopy compress-pdf.sh to your Raycast scripts folder:
cp compress-pdf.sh ~/.config/raycast/scripts/
chmod +x ~/.config/raycast/scripts/compress-pdf.shOr add your custom scripts folder in Raycast preferences.
Open Raycast and the "Compress PDF" command should appear.
- Select one or more PDF files in Finder
- Open Raycast (
⌘ + Spaceor your hotkey) - Type "Compress PDF"
- Choose compression level (optional, defaults to Medium)
- Press Enter
Compressed files are saved in the same directory with _compressed suffix.
The script uses Ghostscript with optimized settings that rival commercial tools like PDF Squeezer:
- Font compression - Compresses and subsets embedded fonts
- Image downsampling - Bicubic resampling for smooth results
- Duplicate detection - Removes redundant embedded images
- Smart quality presets - Ghostscript's
/screen,/ebook,/printerprofiles
The birkhoff/pdf-compression plugin uses basic Ghostscript settings that often fail to compress already-optimized PDFs. This script adds aggressive compression flags that achieve results comparable to PDF Squeezer.
# Before: document.pdf (2.4 MB)
# After: document_compressed.pdf (586 KB)
# Result: ✅ Compressed 1 PDF(s) (saved ~1.8MB)
MIT
Marcin