presse
A fast command-line tool for PDF compression, written in Rust.
Features
- Image recompression — re-encodes images at a target quality, skipping CMYK images
- Structural compression — object stream packing, xref stream compression, unused object removal
- Batch processing — compress multiple files in one command via shell wildcards
- Smart output paths — sensible defaults, explicit naming, or output to a directory
Installation
Usage
# Single file — outputs document_compressed.pdf alongside the original
# Custom output name
# Output to a directory
# Batch — multiple files into a directory
# Set JPEG quality (0–100, default 80)
# Suppress output
Options
| Flag | Default | Description |
|---|---|---|
-o, --output |
<input>_compressed.pdf |
Output file or directory |
-q, --quality |
80 |
Image recompression quality (0–100) |
-v, --verbose |
true |
Print size comparison after each file |
Limitations
- CMYK images are not compressed (not currently handled by
imagecrate)
Dependencies
- lopdf — PDF parsing and manipulation
- clap — CLI argument parsing
- indicatif — Progress bars
- image — JPEG decoding and encoding
Contributions
We are happy to welcome contributions! The next step we have in mind is to migrate to subcommands to implement document merging or splitting in a single CLI! Pull requests are welcome.