presse
A fast command-line tool for PDF compression, written in Rust.
Compress PDF files naturally and easily with this ready-to-use command line tool. You don't want to send your sensitive documents online? Ghostscript is too obscure to use? Presse is the answer! Its usage is very intuitive. Images are decoded, compressed and then re-encoded without intermediate steps, making it fast and reliable. Future features are on the roadmap (maybe from a contributor like you?) for PDF merging, splitting and extraction!
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.