https://github.com/moroii69/gspdfc
https://github.com/moroii69/gspdfc
pdf-compression python
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/moroii69/gspdfc
- Owner: moroii69
- Created: 2025-01-22T20:28:44.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-22T20:31:13.000Z (over 1 year ago)
- Last Synced: 2025-08-22T05:02:16.086Z (11 months ago)
- Topics: pdf-compression, python
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## usage 🎯
this script leverages **ghostscript** under the hood, using its `pdfwrite` device to optimize pdfs by downsampling images, stripping metadata, and re-encoding content for smaller file sizes.
### basic usage
compress all pdfs in a folder:
```bash
$ python compress.py /path/to/your/pdf/folder
```
### advanced options
- **dry run**: simulate compression without modifying files.
```bash
$ python compress.py /path/to/your/pdf/folder --dry-run
```
- **max threads**: limit the number of concurrent threads.
```bash
$ python compress.py /path/to/your/pdf/folder --max-threads 4
```
- **min size**: skip files smaller than the specified size (in mb).
```bash
$ python compress.py /path/to/your/pdf/folder --min-size 10
```
- **log file**: save output to a log file.
```bash
$ python compress.py /path/to/your/pdf/folder --log-file output.log
```
- **verbose mode**: enable detailed output.
```bash
$ python compress.py /path/to/your/pdf/folder --verbose
```