https://github.com/louire/ilovepypdf
Python Script to compress pdf's without losing quality
https://github.com/louire/ilovepypdf
Last synced: about 1 month ago
JSON representation
Python Script to compress pdf's without losing quality
- Host: GitHub
- URL: https://github.com/louire/ilovepypdf
- Owner: louire
- Created: 2025-02-11T01:21:19.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-02-11T01:40:38.000Z (3 months ago)
- Last Synced: 2025-04-01T23:36:59.153Z (about 2 months ago)
- Language: Python
- Size: 5.86 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ILovePyPdf🐍❤️
A Python utility for compressing PDF files while maintaining reasonable quality. This tool provides a simple yet effective way to reduce PDF file sizes for easier sharing and storage.
## Features
* Compress PDF files with customizable quality settings
* Maintain reasonable document quality
* Track compression progress
* Generate detailed compression statistics
* Error handling and logging
* Support for both high-quality and maximum compression modes## Requirements
* Python 3.6 or higher
* PyPDF2 library## Installation
### 1. Clone this repository:
```bash
git clone https://github.com/louire/ILovePyPdf.git
cd ILovePyPdf
```
### 2. Install required dependencies:
```bash
pip install PyPDF2`
```
## Usage### Basic Usage
```bash
`from pdf_compressor import compress_pdf``# Compress with high quality (default)`
`compress_pdf("input.pdf", "output_compressed.pdf")``# Compress with lower quality for smaller file size`
`compress_pdf("input.pdf", "output_compressed.pdf", high_quality=False)`
```
### Command Line Usage`python pdf_compressor.py`
### Example Output
```bash
Processing 5 pages...`
Compressed page 1/5`
Compressed page 2/5`
Compressed page 3/5`
Compressed page 4/5`
Compressed page 5/5`
Saving compressed file...`Compression completed successfully!`
Original size: 1024.55 KB`
Compressed size: 428.73 KB`
Reduction: 58.2%`
Processing time: 2.34 seconds`
```
## License
This project is licensed under the MIT License - see the LICENSE file for details.## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.## Author
[@louire](https://github.com/louire)## Acknowledgments
* PyPDF2 library and its contributors